Commit Graph

78 Commits

Author SHA1 Message Date
Timo Tijhof
36c9ecb0f5 Implement expectation test instead of using _removeData. Close gh-997.
* Removed inline usage of QUnit.reset() because it is messing with the
  expectation model as reset does .empty() which does a recursive cleanData
  on everything in #qunit-fixture, so any expectJqData above .reset() would
  fail negatively.

  Instead of calling reset inline, either updated the following assertions to
  take previous assertions' state into account, or broke the test() up into
  2 tests at the point where it would call QUnit.reset.

* After introducing the new memory leak discovery a whole bunch of tests were
  failing as they didn't clean up everything. However I didn't (yet) add
  QUnit.expectJqData calls all over the place because in most if not all of
  these cases it is valid data storage. For example in test "data()", there
  will be an internal data key for "parsedAttrs". This particular test isn't
  intending to test for memory leaks, so therefor I made the new discovery
  system only push failures when the test contains at least 1 call to
  QUnit.expectJqData.

  When not, we'll assume that whatever data is being stored is acceptable
  because the relevant elements still exist in the DOM anyway (QUnit.reset
  will remove the elements and clean up the data automatically).

  I did add a "Always check jQuery.data" mode in the test suite that will
  trigger it everywhere. Maybe one day we'll include a call to everywhere,
  but for now I'm keeping the status quo: Only consider data left in storage
  to be a problem if the test says so ("opt-in").

* Had to move #fx-tests inside the fixture because ".remove()" test would
  otherwise remove stuff permanently and cause random other tests to fail
  as "#hide div" would yield an empty collection.
  (Why wasn't this in the fixture in the first place?)

  As a result moving fx-tests into the fixture a whole bunch of tests failed
  that relied on arbitrary stuff about the document-wide or fixture-wide
  state (e.g. number of divs etc.). So I had to adjust various tests to
  limit their sample data to not be so variable and unlimited...

* Moved out tests for expando cleanup into a separate test.

* Fixed implied global variable 'pass' in effects.js that was causing
  "TypeError: boolean is not a function" in *UNRELATED* dimensions.js that
  uses a global variable "pass = function () {};" ...

* Removed spurious calls to _removeData. The new test exposed various failures
  e.g. where div[0] isn't being assigned any data anyway.
  (queue.js and attributes.js toggleClass).

* Removed spurious clean up at the bottom of test() functions that are
  already covered by the teardown (calling QUnit.reset or removeClass to
  supposedly undo any changes).

* Documented the parentheses-less magic line in toggleClass. It appeared that
  it would always keep the current class name if there was any (since the
  assignment started with "this.className || ...".

  Adding parentheses + spacing is 8 bytes (though only 1 in gzip apparently).
  Only added the comment for now, though I prefer clarity with logical
  operators, I'd rather not face the yayMinPD[1] in this test-related commit.

* Updated QUnit urlConfig to the new format (raw string is deprecated).

* Clean up odd htmlentities in test titles, QUnit escapes this.
  (^\s+test\(.*)(&gt\;) → $1>
  (^\s+test\(.*)(&lt\;) → $1<

[1] jQuery MinJsGz Release Police Department (do the same, download less)
2012-10-28 22:44:57 -04:00
Timmy Willison
420dcc5842 Update Sizzle: allows disconnected sorting. Change add to always sort with added nodes, even when disconnected. 2012-10-16 11:54:54 -04:00
MORGAN
4bb46f413a Return correct index for no-arg index() calls. Fixes #10977. Closes gh-971 2012-10-16 10:25:08 -04:00
Mike Sherov
ed9e34482a enforce double quotes via JSHint. Closes gh-975 2012-10-16 10:17:14 -04:00
James Huston
435fbe1793 Enforce expects in events.js (https://github.com/jquery/2012-dev-summit/issues/53) Closes gh-962 2012-10-15 12:18:14 -04:00
Timmy Willison
e07b444dfe Fix a regression where has with multiple contexts was not filtering correctly. Test added. 2012-07-27 18:19:18 -04:00
Timmy Willison
17a26f5bd9 Fail silently if closest is somehow called on a document. Fixes #10726. 2012-07-25 16:05:59 -04:00
Dave Methvin
cde4c326b8 Fix #11969. Never a null moment when checking siblings. 2012-06-26 17:08:49 -04:00
Rick Waldron
7ff3da186c Unit tests are linted and passing. 2012-06-21 15:30:24 -04:00
Ben Alman
02dd7c570b jQuery#addBack supports an optional selector that can be used to filter the prior set before adding it back. Fixes #9800 2012-05-29 12:04:27 -04:00
Dave Methvin
f76518e393 Rename .andSelf to .addBack, deprecate .andSelf #9800 2012-05-15 23:14:13 -04:00
Dave Methvin
56d5c1c3a3 Fix #11738. Remove deprecated .closest(Array) => Array. 2012-05-11 15:11:13 -04:00
Richard Gibson
590bcab245 Fix #11543: .has should work on detached elements. 2012-04-05 21:03:41 -04:00
Richard Gibson
a619cb3063 Fix #11370: .siblings() shouldn't throw exception on a detached element 2012-02-23 22:40:07 -05:00
timmywil
2a63b980ed Use Sizzle.Expr.match.globalPOS for identifying POS selectors in traversing. Fixes #10970. 2011-12-12 11:23:47 -05:00
Rick Waldron
7cbd7a640f Coerce eq() argument all the time. Fixes #10616 2011-11-06 16:17:59 -05:00
Mike Sherov
f35ba5e699 Fix #10691. Remove all instances of equals() and same(), as these are deprecated in QUnit. 2011-11-06 15:27:42 -05:00
Dave Methvin
70e2e32e0e Landing pull request 491. Fix #7322. Make .is() with a positional selector work like delegated event logic. Fixes #7322.
More Details:
 - https://github.com/jquery/jquery/pull/491
 - http://bugs.jquery.com/ticket/7322
2011-09-19 23:50:52 -04:00
timmywil
0ced30e319 Move filter tests to proper location 2011-09-19 23:14:37 -04:00
timmywil
11c9de477c Added filtering tests and updating sizzle to fix filtering with positional selectors. Fixes #10315. 2011-09-19 23:09:40 -04:00
timmywil
92405d4f5f Override Sizzle attribute retrieval with jQuery.attr. Fixes #5637, #7128, #9261, #9570, #10178.
Bug fixed on the side: $(window).is('a') was throwing an exception. Fixes #10178.
2011-09-19 15:42:30 -04:00
Rick Waldron
13647e94e0 Fixes assertion counts and dom element fixture issue 2011-08-05 10:02:33 -04:00
gnarf
9a96af1d59 Quick improvement to the performace of .index() with no arguments - Adding a unit test for .index() of a node without a parent returns -1 2011-06-14 23:38:36 -05:00
John Resig
9b00827ac9 Disabling .add(form.elements) unit test. 2011-04-22 00:51:23 -04:00
timmywil
3aa46725ed Merge branch 'qunit_fixture' 2011-04-17 14:12:31 -04:00
John Resig
728a70c036 Make sure that forms and selects are added to a jQuery set correctly. Fixes #6912. 2011-04-17 10:51:24 -07:00
timmywil
ecf6a3c383 Switch QUnit div from depreceted #main to #qunit-fixture 2011-04-17 02:43:57 -04:00
timmywil
38d6d9f6e0 Adjust the unit tests in traversing - is(jQuery) to avoid long-running script alerts 2011-04-14 00:46:10 -04:00
louisremi
a5604aedb7 merge with master and resolve more conflicts 2011-04-12 11:29:25 +02:00
louisremi
8547b34f92 resolve conflict 2011-04-12 11:18:44 +02:00
louisremi
f42010b657 third batch 2011-04-12 10:47:46 +02:00
timmywil
a564a0b1ec Run order problem when running full test suite in Opera 11, removed failing test as it passed by itself and there are others just like it 2011-04-11 12:24:31 -04:00
jeresig
6591f6dd9d Fix broken merge. 2011-04-11 11:22:52 -04:00
jeresig
909a6ff60a Merge branch 'bug_7369' of https://github.com/timmywil/jquery into timmywil-bug_7369 2011-04-10 16:48:02 -04:00
jeresig
523db95de2 Merge branch '2773_find_closest' of https://github.com/timmywil/jquery into timmywil-2773_find_closest
Conflicts:
	test/unit/traversing.js
2011-04-10 16:37:09 -04:00
timmywil
a807451a23 Fixes #7369 - Using an attribute selector for a non-existent attribute raised an exception on disconnected nodes 2011-03-30 23:39:19 -04:00
timmywil
1a16776730 Remove test for bug #7369 to move the fix to a separate branch for a sooner pull 2011-03-30 23:23:38 -04:00
timmywil
e93ca40aa7 Bug #7369: Check non-existent attribute as well to be sure 2011-03-25 23:52:36 -04:00
timmywil
e6da0fa6a9 Bug #7369: Add test for disconnected node in closest when passing attribute selector; this was recently fixed in 1.5.2rc 2011-03-25 23:46:29 -04:00
timmywil
85232c97bf Traversing unit tests: added tests for passing invalid arguments to $.fn.not (should have no effect on existing object rather than return an empty object as filter does) 2011-03-23 16:04:12 -04:00
timmywil
b8013581ce Closest unit tests: add one for passing a jQuery collection with multiple elements 2011-03-23 15:56:05 -04:00
timmywil
e09d8898d8 Add node and jQuery object support to $.fn.closest 2011-03-21 20:59:20 -04:00
timmywil
7a69e34a5c 2773: first pass adding node/jQuery object support to jQuery.fn.find; unit tests added 2011-03-16 01:16:32 -04:00
timmywil
8246347b71 Starting with adding the test 2011-03-13 21:12:10 -04:00
timmywil
9e5ec378e3 Merge branch 'master' of git://github.com/jquery/jquery into bug_2773 2011-02-26 18:53:25 -05:00
Anton M
8e40a84c24 Fix some unscoped tests which failed after recent changes to QUnit. 2011-02-15 21:03:34 +01:00
Timmy Willison
ed48787ec5 Fix bug #2773, jQuery.fn.is to accept JQuery and node objects, and a small fix for winnow getting an undefined selector 2011-01-24 16:18:19 -05:00
John Resig
2e2d5e9db5 Merge branch 'fix-7853-add-context' of https://github.com/dmethvin/jquery into dmethvin-fix-7853-add-context 2011-01-20 14:51:30 -05:00
Dave Methvin
948c0dfffc Rework unit tests to check actual result elements. 2011-01-19 21:02:46 -05:00
Colin Snover
e2941d5a98 Update unit tests with a leak detection mechanism for the various jQuery globals and fix all leaks in the tests. 2011-01-09 15:58:47 -06:00