976 Commits

Author SHA1 Message Date
Graeme Yeates
1db79ddd33 Fix 1.3.1 regression with once and no context 2016-03-08 11:23:00 -05:00
Ash Lux
32d89dc47e When listening to numerous events and stopListening is called, then _.isEmpty is painfully slowly and assigning _listenTo to undefined isn't necessary. 2016-02-08 15:16:10 -05:00
Adam Krebs
8d8b854abf rename at => val in test to be clearer 2016-02-04 17:16:06 -05:00
Craig Martin
8932ae4bc3 optimize collection get and account for edge case 2016-02-04 15:30:26 -05:00
Craig Martin
47fb04a373 fix failing linting tests 2016-02-04 15:16:41 -05:00
Adam Krebs
b0161947eb Fix #3951: options.index should never exceed collection.length 2016-02-04 15:01:59 -05:00
Justin Ridgewell
92fb299c2a Use _.extend to avoid Object.prototype collisions 2016-02-03 12:56:45 -05:00
Justin Ridgewell
67790b27de Merge pull request #3945 from jridgewell/collection-has-test-fix
Use strictEqual in Collection#has Tests
2016-02-02 11:27:19 -05:00
Justin Ridgewell
2f85060e59 Upgrade vendor QUnit 2016-02-02 11:21:37 -05:00
Graeme Yeates
c380607704 Merge pull request #3940 from roycetucker/patch-2
Fixing object notation for Events.once
2016-02-01 13:52:57 -05:00
Graeme Yeates
670ff30aa4 Improve collection 'update' event consistency 2016-02-01 11:33:39 -05:00
Linus-A. M. Gubenis
90cb566250 Pass added and removed models to collection update events 2016-02-01 11:18:09 -05:00
Royce Tucker
d2099dd283 Adding a unit test for once with object notation 2016-01-30 14:37:37 -06:00
Craig Martin
1aa7f7685a add tests solidifying behavior for modelId with polymorphic models 2016-01-20 09:23:50 -05:00
Adam Krebs
82d8ec840c Merge pull request #3929 from craigmichaelmartin/avoid-redefinitions
eliminate shadowed variable declarations
2016-01-19 13:56:36 -05:00
Craig Martin
e0a5cc75ba eliminate shadowed variable declarations
Also, add eslint rule no-shadow to enforce
2016-01-19 12:34:08 -05:00
Craig Martin
75666b08c9 add has method to collection 2016-01-17 12:19:36 -05:00
Jordan Eldredge
be1f2a87c5 Add ESLint rule: eqeqeq
Underscore uses this triple-equals syntax for its module loader.
2015-12-28 21:37:17 -08:00
Jordan Eldredge
89d50840b6 Add ESLint rule: dot-notation 2015-12-28 21:09:44 -08:00
Jordan Eldredge
1c66a6e127 Add ESLint warning: no-extra-parens
This is only enabled as a warning, since in some cases I think it adds clarity.
I left the "gratuitous parentheses" when they were clarifying nested ternary
operators or clarifying the evaluation order of `&&`s and `||`s.
2015-12-20 11:34:49 -08:00
Jordan Eldredge
37465828d6 Add ESLint warning for quoted keys to tests
I've opted to leave the quotes and associated warnings in the case where the
keys include protected words or integers.
2015-12-18 13:27:48 -08:00
Jordan Eldredge
9eb9124ec9 Enforce camelCase ESLint rule in tests 2015-12-18 13:27:48 -08:00
Jordan Eldredge
42392c3aad Reenable already passing ESLint rules for tests
Previous changes made these exceptions obsolete.
2015-12-18 13:27:48 -08:00
Jordan Eldredge
3dbdfab21b Enable ESLint semicolons for tests 2015-12-18 13:27:48 -08:00
Jordan Eldredge
d91405d54f Enable ESLint rule: 'quotes' for tests
These changes were done automatically by ESLint's `--fix` tag. Thanks ESLint!
2015-12-18 13:27:48 -08:00
Jordan Eldredge
7dbdd0ac6b Add ESLint rule: no-undef 2015-12-18 13:27:48 -08:00
Adam Krebs
12da1e3eb1 remove superfluous spaces from model test 2015-12-18 12:58:04 -05:00
Jordan Eldredge
2f5cd8bee9 Enable ESLint rule: new-cap
Constructor functions must start with a capital letter.
2015-12-18 08:35:28 -08:00
Jordan Eldredge
2ae117a7cb Add ESLint rule: key-spacing 2015-12-16 10:00:19 -08:00
Jordan Eldredge
b0a6274290 Non-controversial ESLint whitespace rules
In an attempt to bring our ESLint rules closer to those in Underscore, I've
started by adding some whitespace rules which don't involve any significantly
opinionated changes.
2015-12-16 07:43:26 -08:00
Jordan Eldredge
bf0527897f Enable ESLint
This pull request replaces the old "jsl" linter with ESLint and enables it as
part of our integration tests.

So far, the only rules it includes are the ones which are both currently
enforced in Underscore AND are already passing in Backbone.

I will follow up with individual pull requests for each rule which will require
changes to the code in an attempt to bring us in sync with Underscore's style.
2015-12-15 16:25:59 -08:00
Ilia Ablamonov
19b88d2c2d Fixed Collection#set regression when parse returns falsy value
Fixes #3871
2015-12-01 10:00:36 +04:00
Adam Krebs
15ac7503b2 enable QUnit.config.noglobals in tests 2015-11-12 14:26:19 -05:00
Justin Ridgewell
7fb6f48966 Test case for model.id 2015-11-02 10:50:59 -05:00
Justin Ridgewell
569f07e6a6 Merge pull request #3820 from jridgewell/reduce-deopt
Deopt Underscore methods that change on arguments
2015-10-28 09:36:49 -05:00
Graeme Yeates
d1880dda6c Merge pull request #3834 from jridgewell/model-change-id-regression
Fix _onModelEvent regression
2015-10-26 15:18:41 -04:00
Justin Ridgewell
67667c5b8f Fix _onModelEvent regression
Fixes #3662.
2015-10-26 15:13:17 -04:00
Justin Ridgewell
7bbbcc8c51 Always return removed array from #_removeModels
Fixes #3835.
2015-10-26 11:19:26 -04:00
Adam Krebs
fee53ab464 Merge pull request #3822 from captbaritone/indent-fix
Fix indentation in models test
2015-10-07 12:40:07 -04:00
Jordan Eldredge
95512b0692 Fix indentation in models test 2015-10-07 09:08:48 -07:00
Justin Ridgewell
2e60498b3d Merge pull request #3821 from captbaritone/indent-fix
Fix indention in tests
2015-10-07 11:04:18 -05:00
Jordan Eldredge
2984d95a85 Fix indention in tests 2015-10-07 08:57:41 -07:00
Adam Krebs
e08e195830 Merge pull request #3818 from captbaritone/collection-initialize-null-models
Document using [] for Collections with zero models
2015-10-07 11:54:38 -04:00
Jordan Eldredge
4b6ad311bd Document using [] for empty Collections with options
The documented example shows passing `[]` to instantiate an empty collection
while still supplying an options object. This change makes the preceding
documentation consistent with that example.

I also noticed that we don't have any tests covering the previously recommended
approach of passing `null` (or any falsey value) for models. I've added a test
to ensure we continue to support that usage.
2015-10-07 08:49:52 -07:00
just-boris
345dd7b128 Allow to make reduce without initial value 2015-10-07 10:59:00 -04:00
Jordan Eldredge
9fb2f19764 Make implicit ;s in tests explicit 2015-10-07 07:52:35 -07:00
Kevin Partington
9c681906a4 Tests: Migrated unit tests to QUnit 2.0 syntax. (fixes #3813) 2015-10-06 23:35:30 -05:00
Jacob Buck
6cff9419fb Add findIndex and findLastIndex underscore methods to Collection. 2015-09-30 10:20:33 +13:00
Jeremy Ashkenas
979adf5200 Merge pull request #3803 from jridgewell/removeModels-regression
Fix _removeModels regression
2015-09-25 10:48:48 -04:00
Justin Ridgewell
4b64eebcba Fix _removeModels regression
Fixes #3693.

This leaves open the question of whether events triggered on the model
during a ‘remove’ listener should also trigger on the model. Just
something to revisit for V2.

```js
col.on('other', (model) => {
// Should this be triggered?
});

col.on('remove', (model) => {
// If the model is really "removed" (we can't `#get` it anymore)
// by the time this listener is called, then I'd argue that this
// shouldn't trigger the 'other' event on the collection...
model.trigger('other');
});
```
2015-09-23 11:24:16 -04:00