Commit Graph

945 Commits

Author SHA1 Message Date
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
Graeme Yeates
3c6fabbc8f Use _.create in extend 2015-09-18 12:58:02 -04:00
Garrett Maring
afd2ce8b59 Test for conflicting className/id and attributes 2015-09-17 16:44:36 -07:00
Andrew Humphreys
91d0824190 fix error when adding model to collection at an out of bounds index 2015-08-21 17:15:07 +01:00
Jeremy Ashkenas
09fca1dc7e Merge pull request #3663 from jridgewell/collection-set-style-compat
Collection#set style (Backwards Compatible)
2015-08-18 17:35:20 -04:00
Justin Ridgewell
a6e2f0fb54 Test null set doesn't clear model.
https://github.com/jashkenas/backbone/pull/3663#discussion_r36124174
2015-08-07 13:20:41 -04:00
John-David Dalton
0bc02af704 Use some, includes, map in tests instead of any, include, pluck. 2015-08-07 01:58:09 -07:00
Justin Ridgewell
f4d4557592 Setup DOM for every view test
Karma QUnit v0.1.5 now removes and reinserts the `#qunit-fixture`
element before every test.
2015-08-04 01:13:48 -04:00
Linus-A. M. Gubenis
d6dd17c1ee typos 2015-07-13 09:50:11 -05:00
Linus-A. M. Gubenis
a37d30a3e1 Update collection.js 2015-07-13 09:43:55 -05:00
sophietk
0d43789682 Fix test for IE7/IE8 build 2015-06-24 10:25:45 +02:00
Justin Ridgewell
f55b4a2245 Merge pull request #3680 from akre54/multi-event-maps
Event maps should support multiple event syntax
2015-06-18 10:21:50 -04:00
sophietk
007a1b85f4 Collection methods from underscore (reject, filter, some, every, ...) take function, set of model attributes, or attribute name as argument
- Expand the use of inherited underscore methods, to iteratee as function, object or string
- Apply iteratee transformation to groupBy, countBy, sortBy, indexBy
2015-06-11 18:04:30 +02:00
Adam Krebs
6b927eb5e7 Event maps should support multiple event syntax 2015-06-10 17:33:03 -04:00
Justin Ridgewell
c40396228b Fix incorrect test 2015-06-10 14:26:37 -04:00
jdalton
74427c9e76 Remove the only _.bindAll use. 2015-06-09 11:01:57 -07:00
Justin Ridgewell
0052c2fc5c Keep backwards compatibility with v1 2015-06-03 20:59:59 -04:00
Justin Ridgewell
a082d2fdf9 Return only added or merged models
Mirrors the change in #3512.
2015-06-03 02:53:40 -04:00
Justin Ridgewell
e81474880b Don't bother with Collection#set unless models 2015-06-03 02:52:57 -04:00
Justin Ridgewell
fdea29dfc8 Collection#add shouldn't parse a model instance
Fixes #3636, but in a backwards compatible way.
2015-06-02 14:06:50 -04:00
Andrey Kuzmin
ffa4fa597d Added failing test case 2015-06-02 13:58:13 -04:00
Justin Ridgewell
c95d9775e7 Revert "Merge pull request #3644 from jridgewell/collection-parse"
This reverts commit ff57b54cbb, reversing
changes made to 5ea158506f.
2015-06-02 13:55:21 -04:00
Jeremy Ashkenas
ff57b54cbb Merge pull request #3644 from jridgewell/collection-parse
Collection parse
2015-06-02 13:29:58 -04:00
Justin Ridgewell
f79e0bcf53 Fix failing IE6 test
It was a false positive. Our “location” parsing uses an A tag, which
doesn’t always work the way the real location parsing does.
2015-06-02 12:26:41 -04:00
Justin Ridgewell
a41a2056f9 Merge pull request #3603 from jridgewell/event-map-context
Juggle context param with event maps
2015-06-01 10:29:14 -04:00
Justin Ridgewell
13de636df1 Ensure fetch'd data is only parsed once 2015-05-30 02:27:51 -04:00
Justin Ridgewell
415c3a7a13 Collection#set shouldn't parse
Fixes #3636, #2824.

Reverts #1407.
2015-05-30 02:27:51 -04:00
Jeremy Ashkenas
2e465970e0 Merge pull request #3637 from jridgewell/collection-removeModels
Return removed models from #_removeModels
2015-05-27 11:49:44 -04:00
Justin Ridgewell
61e765087d Test that Collection#remove _only_ returns removed models
Add (currently) failing tests for #3512.
2015-05-27 11:42:42 -04:00
Jeremy Ashkenas
165034b861 Merge pull request #3628 from jridgewell/model-fetch-style
Model#fetch parse option
2015-05-26 17:34:04 -04:00
Justin Ridgewell
11071babd4 Test #setElement 2015-05-23 20:35:03 -04:00
Justin Ridgewell
00226d5a57 Test #remove returns view 2015-05-23 20:34:55 -04:00