Commit Graph

122 Commits

Author SHA1 Message Date
Brad Dunbar
4ecc161ecf Tweak tests a bit. 2012-06-15 11:30:49 -04:00
Casey Foster
f24ca5a0ed #1412 - Trigger "sync" event for fetch also 2012-06-15 07:33:38 -07:00
Brad Dunbar
39551232d7 Quote attributes correctly for older browsers. 2012-06-14 14:47:57 -04:00
Brad Dunbar
f133f0d5dc Ensure tests run in IE7. 2012-06-12 11:31:34 -04:00
Brad Dunbar
41f64c7f1a Refactor a test for simplicity. 2012-06-03 13:55:40 -04:00
Sam Breed
626e3f16f7 adding correct number of expected assertions to nested change events model test 2012-06-03 11:38:18 -06:00
Sam Breed
f4ebee0406 adding the expected argument to all tests 2012-06-02 18:07:11 -06:00
Sam Breed
c924e05bff adding tests for #1355 2012-05-30 11:32:53 -04:00
Sam Breed
cacd01d530 Fix #1292 - unexpected results when passing undefined to Model.hasChanged()
* additional check in hashChanged for when `attr` is present but undefined
* adds tests for expected results when passing undefined
2012-05-07 19:45:03 -06:00
Brad Dunbar
70005fdd04 Update QUnit.
* Use `deepEqual` in place of `same`.
* Expect 0 tests where appropriate.
* Update view test to use #qunit-fixture.
* Remove `QUnit.config.reorder = false;`.
2012-05-02 20:54:27 -04:00
Brad Dunbar
64205fbd1f Add tests for #1122. 2012-04-24 11:33:15 -04:00
Jeremy Ashkenas
bf9e4f6335 adding a test for the previous commit -- failed save with wait:true 2012-04-23 17:58:10 -04:00
Brad Dunbar
87c9b17aa7 Fix #474 - Backbone.ajax 2012-04-11 08:33:20 -04:00
Brad Dunbar
137b7fd670 Fix #1179 - isValid returns true in the absence of validate. 2012-04-04 05:28:40 -07:00
Jeremy Ashkenas
f4a1ebc374 fixes #1030 -- save with wait:true with a synchronous Backbone.sync 2012-03-21 11:18:30 -04:00
Jeremy Ashkenas
e9e1abfe61 model.destroy() returns false if the model.isNew() 2012-03-21 10:40:54 -04:00
Brad Dunbar
6948b59e61 Fix #1057 - Save with wait validates model. 2012-03-18 08:59:23 -04:00
Jeremy Ashkenas
64f37ce00e fixes #1067, urlRoot vs collection.url() order 2012-03-12 11:22:44 -04:00
Aidan Feldman
f49969014c clean up tests to use fresh object instances for each run, and don't set
globals within test files
2012-03-12 04:27:22 -04:00
Jeremy Ashkenas
83d2918bc7 removing a test that is invalid in IE. 2012-02-27 14:32:30 -05:00
Brad Dunbar
69b80f5e3a Fixes #959 - Silent changes fire 'change:attr'.
* Silent changes are tracked so `'change:attr'` can be
  fired next time `change` is called.
* Pending changes are tracked to prevent infinite loops
  and accurately reflect nested changes.
2012-02-17 07:22:43 -05:00
Brad Dunbar
1d921d690a Add tests for #906. 2012-02-02 20:26:41 -05:00
Brad Dunbar
954da679ed Refactor some tests.
* Use object for lastRequest to prevent errors.
* Ensure setDOMLibrary tests are cleaned up.
2012-02-02 19:36:50 -05:00
Jeremy Ashkenas
eb4753862e #917, adding an Model#isValid() function. 2012-02-02 15:54:34 -05:00
Jeremy Ashkenas
aafbcb05e5 Fixes #917 -- reverts validate() behavior to never run on silent sets. 2012-02-02 15:40:06 -05:00
Brad Dunbar
29a4359ff7 fixes #915 - nested 'change:attr' events
* `'change'` does not fire without changes
* nested `'change:attr'` events are fired
* `'change'` is only fired once for nested calls
* nested `'change'` events are fired
2012-02-02 10:49:27 -05:00
Brad Dunbar
ec61503c87 fixes #928 - Save sends correct attrs.
* Temporarily set model's attrs for `sync`.
* Remove cross-module (global) dependencies in
  Collection, Model, and sync test modules.
2012-02-02 08:57:47 -05:00
Brad Dunbar
bc79feaf5a passing falsey keys to hasChanged or previous 2012-02-01 16:06:36 -05:00
Brad Dunbar
db95e2c1fb fixes #907 - save with wait succeeds without validate 2012-01-31 10:02:05 -05:00
Jeremy Ashkenas
4b4f2c1ad6 missed an API regression in model.changedAttributes(), reimplementing in the same way as the original. 2012-01-30 12:18:58 -05:00
Brad Dunbar
2a6624cb24 use _.has for Object proto props 2012-01-30 05:52:47 -05:00
Brad Dunbar
2f654d2676 cache changed attributes 2012-01-30 05:00:41 -05:00
Brad Dunbar
0d6e5f3934 Fire 'change:attr' from change 2012-01-27 14:07:33 -05:00
Jeremy Ashkenas
ab164c450d Overhauling 'validate' -- Receives the computed new state of the attrs, not just the delta. Now runs on model create, raising an exception if you try to 'new' and invalid model ... also runs even if changed silently. 2012-01-23 18:16:20 -05:00
Jeremy Ashkenas
36fde545f9 Merge pull request #872 from vovik/master
fixed typo in test for (presumably) equality
2012-01-22 10:04:57 -08:00
Brad Dunbar
3a891854e8 setting undefined attributes
* undefined attrs should still be set
* unset triggers change for undefined attrs
* values are set regardless of change/equality
2012-01-20 11:02:46 -05:00
vlad
c7c7b3c1a1 fixed typo in test for (presumably) equality 2012-01-18 13:49:09 -08:00
Brad Dunbar
b05deb5fb5 fix #871 - calling set with 'attributes' property 2012-01-18 12:45:09 -05:00
Brad Dunbar
397d11e340 equals is deprecated; use equal instead
http://docs.jquery.com/QUnit/equal#actualexpectedmessage
2012-01-17 23:52:12 -05:00
Jeremy Ashkenas
cea56e523a Fixes #563. Initial draft of 'wait: true' for pessimistic instead of optimistic save() create() and destroy(). Makes it easier to have your asynchronous UI and eat it too. 2012-01-17 15:26:26 -05:00
Jeremy Ashkenas
42d321f236 Fixes #570, supports Model#save(key, value) 2012-01-17 11:55:15 -05:00
Jeremy Ashkenas
34e0f7fb26 Fixes #582, fixes #425, run a second loop to trigger change:attribute events after all changes have been made. 2012-01-13 17:08:48 -05:00
Jeremy Ashkenas
4316b04ffa allow the passing of any number of arguments to Model#initialize 2012-01-13 16:10:14 -05:00
Jeremy Ashkenas
51335bf10f Fixes #641 -- on and off are now the preferred names for bind and unbind, following jQuery. 2012-01-13 15:27:57 -05:00
Jeremy Ashkenas
1d90bb9cfc binding the comparator function before using it, so that you can rely on properties of your collection within it. 2012-01-12 15:13:22 -05:00
Jeremy Ashkenas
6b3ff7b035 Fixes #9, Backbone comparators can now be either sort() or sortBy() iterators. 2012-01-06 14:53:43 -05:00
Jeremy Ashkenas
060da2b991 Merge pull request #842 from braddunbar/hasChanged-comparison
hasChanged/set should use the same comparison
2012-01-06 06:58:55 -08:00
Brad Dunbar
934aba4c6e hasChanged/set should use the same comparison
When setting a value, if hasChanged and set disagree
about equality then hasChanged will return true without
firing a 'changed:*' event (or vice versa).  Using the
same comparison (_.isEqual) solves this problem.
2012-01-06 09:19:23 -05:00
=
b4e650b98f A model's urlRoot can now be a function allowing definition at runtime. 2011-12-22 15:23:12 -10:00
Magnus Holm
bdbcfa9da2 parse:true runs the attributes through parse():
`new Model(attr, {parse:true})` will now call
Model.prototype.parse(attr). This is useful if
you want to create a model out of an object
structure from an external server.
2011-12-04 17:48:47 +01:00