aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
Commit message (Collapse)AuthorAgeFilesLines
...
* Tests: Pass a number of necessary done() calls to assert.async()Michał Gołębiowski-Owczarek2020-03-022-10/+10
| | | | | | It is no longer needed to create `done` wrappers in tests that require multiple async operations to complete. Closes gh-4633
* Core: Fire iframe script in its context, add doc param in globalEvalMichał Gołębiowski-Owczarek2020-02-102-0/+34
| | | | | | | | | | 1. Support passing custom document to jQuery.globalEval; the script will be invoked in the context of this document. 2. Fire external scripts appended to iframe contents in that iframe context; this was already supported & tested for inline scripts but not for external ones. Fixes gh-4518 Closes gh-4601
* Attributes: Refactor val(): don't strip carriage return, isolate IE workaroundsMichał Gołębiowski-Owczarek2020-01-131-0/+51
| | | | | | | | | | Before this change, `val()` was stripping out carriage return characters from the returned value. No test has relied on that. The logic was different for option elements as its custom defined hook was omitting this stripping logic. This commit gets rid of the carriage return removal and isolates the IE-only select val getter to be skipped in other browsers. Closes gh-4585
* Tests: Remove obsolete jQuery data testsMichał Gołębiowski-Owczarek2020-01-133-23/+0
| | | | | The tests relied on `jQuery.cache` so they only ever worked in jQuery 1.x. Closes gh-4586
* Build:Tests: Fix custom build tests, verify on Travis Michał Gołębiowski-Owczarek2020-01-079-32/+100
| | | | | | | | | | | This commit fixes unit tests for the following builds: 1. The no-deprecated build: `custom:-deprecated` 2. The current slim build: `custom:-ajax,-effects` 3. The future (#4553) slim build: `custom:-ajax,-callbacks,-deferred,-effects` It also adds separate Travis jobs for the no-deprecated & slim builds. Closes gh-4577
* Docs: Update links to EdgeHTML issues to go through Web ArchiveMichał Gołębiowski-Owczarek2020-01-071-3/+3
| | | | | | With Microsoft going Chromium with Edge, its old EdgeHTML issues were all removed. :( Closes gh-4584
* Selector: Remove the "a:enabled" workaround for Chrome <=77Michał Gołębiowski-Owczarek2019-12-161-5/+1
| | | | | | | Remove the workaround for a broken `:enabled` pseudo-class on anchor elements in Chrome <=77. These versions of Chrome considers anchor elements with the `href` attribute as matching `:enabled`. Closes gh-4569
* Build: Make Karma work in ES modules modeMichał Gołębiowski-Owczarek2019-12-161-1/+1
| | | | | | Also, run such a suite in CI to make sure modules are working as expected when used directly. Closes gh-4550
* Event: Only attach events to objects that accept data - for realMichał Gołębiowski-Owczarek2019-12-091-0/+9
| | | | | | | | | | There was a check in jQuery.event.add that was supposed to make it a noop for objects that don't accept data like text or comment nodes. The problem was the check was incorrect: it assumed `dataPriv.get( elem )` returns a falsy value for an `elem` that doesn't accept data but that's not the case - we get an empty object then. The check was changed to use `acceptData` directly. Fixes gh-4397 Closes gh-4558
* Selector: Make empty attribute selectors work in IE againMichał Gołębiowski-Owczarek2019-11-182-4/+15
| | | | | | | | | | qSA in IE 11/Edge often (but not always) don't find elements with an empty name attribute selector (`[name=""]`). Detect that & fall back to Sizzle traversal. Interestingly, IE 10 & older don't seem to have the issue. Fixes gh-4435 Closes gh-4510
* Tests: Skip a "width/height on a table row with phantom borders" test in FirefoxMichał Gołębiowski-Owczarek2019-10-281-1/+8
| | | | | | | | | | | | Firefox 70 & newer fail this test but the issue there is more profound - Firefox doesn't subtract borders from table row computed widths. Closes gh-4537 Ref jquery/jquery#4529 Ref https://bugzilla.mozilla.org/show_bug.cgi?id=1590837 Ref w3c/csswg-drafts#4444 (cherry picked from commit c79e1d5fefc50b1df0a1c2ca3f06b567e79c0f9b)
* Tests: Don't test synchronous XHR on unload in ChromeMichał Gołębiowski-Owczarek2019-10-281-8/+13
| | | | | | | | | | Chrome 78 dropped support for synchronous XHR requests inside of beforeunload, unload, pagehide, and visibilitychange event handlers. See https://bugs.chromium.org/p/chromium/issues/detail?id=952452 Closes gh-4536 (cherry picked from commit c5b48c8caa58e7b73164ac033bf726a072903708)
* Docs: Update most URLs to HTTPSMichał Gołębiowski-Owczarek2019-10-214-12/+12
| | | Closes gh-4511
* Selector: Add a test for throwing on post-comma invalid selectorsMichał Gołębiowski-Owczarek2019-10-211-1/+2
| | | | | | | | | | | | | Sizzle's PR jquery/sizzle#456 introduced a test catching not throwing on badly-escaped identifiers by Firefox 3.6-5. Unfortunately, it was placed just before a test Opera 10-11 failed, making Opera fail quicker and not adding a post-comma invalid selector to rbuggyQSA. The issue was fixed in jquery/sizzle#463. This jQuery commit backports the test that Sizzle PR added as no workarounds are needed in browsers jQuery supports. Closes gh-4516 Ref jquery/sizzle#456 Ref jquery/sizzle#463
* Tests: Stop using jQuery.find in testsMichał Gołębiowski-Owczarek2019-10-211-108/+108
| | | | | This prepares us for possibly hiding jQuery.find in jQuery 4.0. Closes gh-4517
* CSS: Workaround buggy getComputedStyle on table rows in IE/EdgeMichał Gołębiowski-Owczarek2019-10-142-0/+26
| | | | Fixes gh-4490 Closes gh-4506
* Ajax: Do not execute scripts for unsuccessful HTTP responsesSean Robinson2019-09-261-0/+115
| | | | | | | | | The script transport used to evaluate fetched script sources which is undesirable for unsuccessful HTTP responses. This is different to other data types where such a convention was fine (e.g. in case of JSON). Fixes gh-4250 Closes gh-4379
* Core: Use Array.prototype.flat where supportedAhmed.S.ElAfifi2019-09-251-1/+18
| | | | | | | | | | | Calling `Array.prototype.concat.apply( [], inputArray )` to flatten `inputArray` crashes for large arrays; using `Array.prototype.flat` avoids these issues in browsers that support it. In case it's necessary to support these large arrays even in older browsers, a polyfill for `Array.prototype.flat` can be loaded. This is already being done by many applications. Fixes gh-4320 Closes gh-4459
* Core: Implement .even() & .odd() to replace POS :even & :oddMichał Gołębiowski-Owczarek2019-09-241-0/+12
| | | | | | `:even` & `:odd` are deprecated since jQuery 3.4.0 & will be removed in 4.0.0. The new `even()` & `odd()` methods will make the migration easier. Closes gh-4485
* Selector: reduce size, simplify setDocumentMichał Gołębiowski-Owczarek2019-08-261-2/+16
| | | | | | | | | | | With new selector code doing less convoluted support tests, it was possible to extract a lot of logic out of setDocument & also reduce size. This commit also backports jquery/sizzle#439 that was reverted by mistake during a switch from JSHint + JSCS to ESLint. Closes gh-4462 Ref jquery/sizzle#442 Ref jquery/sizzle#439
* Core: Deprecate jQuery.trimShashanka Nataraj2019-08-223-24/+23
| | | | | Fixes gh-4363 Closes gh-4461
* Tests: Port changes from SizzleRichard Gibson2019-08-201-3/+11
| | | | Ref https://github.com/jquery/sizzle/pull/450 Closes gh-4464
* Selector: Leverage the :scope pseudo-class where possibleMichał Gołębiowski-Owczarek2019-08-192-7/+72
| | | | | | | | | | | | | | | | | | | The `:scope` pseudo-class[1] has surprisingly good browser support: Chrome, Firefox & Safari have supported if for a long time; only IE & Edge lack support. This commit leverages this pseudo-class to get rid of the ID hack in most cases. Adding a temporary ID may cause layout thrashing which was reported a few times in [the past. We can't completely eliminate the ID hack in modern browses as sibling selectors require us to change context to the parent and then `:scope` stops applying to what we'd like. But it'd still improve performance in the vast majority of cases. [1] https://developer.mozilla.org/en-US/docs/Web/CSS/:scope Fixes gh-4453 Closes gh-4454 Ref gh-4332 Ref jquery/sizzle#405
* Selector: Inline Sizzle into the selector moduleMichał Gołębiowski-Owczarek2019-07-298-149/+151
| | | | | | | | | | | | | | | | | | This commit removes Sizzle from jQuery, inlining its code & removing obsolete workarounds where applicable. The selector-native module has been removed. Further work on the selector module may decrease the size enough that it will no longer be necessary. If it turns out it's still useful, we'll reinstate it but the code will look different anyway as we'll want to share as much code as possible with the existing selector module. The Sizzle AUTHORS.txt file has been merged with the jQuery one - people are sorted by their first contributions to either of the two repositories. The commit reduces the gzipped jQuery size by 1460 bytes compared to master. Closes gh-4395
* Selector: Port Sizzle tests to jQueryMichał Gołębiowski-Owczarek2019-06-265-140/+1745
| | | | | | | Apart from porting most Sizzle tests to jQuery (mostly to its selector module), this commit fixes selector-native so that a jQuery custom compilation that excludes Sizzle passes all tests as well. Closes gh-4406
* Core: Remove IE-specific support tests, rely on document.documentModeMichał Gołębiowski-Owczarek2019-05-1313-310/+241
| | | | | | | Also, update some tests to IE-sniff when deciding whether to skip a test. Fixes gh-4386 Closes gh-4387
* Traversing: Fix `contents()` on `<object>`s with childrenPat O'Callaghan2019-05-061-0/+13
| | | | Fixes gh-4384 Closes gh-4385
* Core: Drop support for IE <11, iOS <11, Firefox <65, Android Browser & PhantomJSMichał Gołębiowski-Owczarek2019-04-2911-671/+224
| | | | | | | | | | | Also, update support comments format to match format described in: https://github.com/jquery/contribute.jquery.org/issues/95#issuecomment-69379197 with the change from: https://github.com/jquery/contribute.jquery.org/issues/95#issuecomment-448998379 (open-ended ranges end with `+`). Fixes gh-3950 Fixes gh-4299 Closes gh-4347
* Tests: Restrict an event test fallback to TestSwarmRichard Gibson2019-04-291-1/+1
| | | | Closes gh-4357
* Core: Remove deprecated jQuery APIsMichał Gołębiowski-Owczarek2019-04-293-464/+10
| | | | Fixes gh-4056 Closes gh-4364
* Tests: Fix the new focusin/focusout test in IEMichał Gołębiowski-Owczarek2019-04-291-44/+59
| | | | | | In IE, focus & blur events fire asynchronously, the test now accounts for that. Ref gh-4362
* Event: Stop shimming focusin & focusout eventsMichał Gołębiowski-Owczarek2019-04-292-24/+34
| | | | | | | | | | | Latest versions of all browsers now implement focusin & focusout natively and they all converged on a common event order so it doesn't make much sense for us to normalize it to a different order anymore. Note that it means we no longer guarantee that focusin fires before focus and focusout before blur. Fixes gh-4300 Closes gh-4362
* Data: Separate data & css/effects camelCase implementationsMichał Gołębiowski-Owczarek2019-04-292-1/+34
| | | | | | | | The camelCase implementation used by the data module no longer turns `-ms-foo` into `msFoo` but to `MsFoo` now. This is because `data` is supposed to be a generic utility not specifically bound to CSS use cases. Fixes gh-3355 Closes gh-4365
* Event: Fix handling of multiple async focus eventsRichard Gibson2019-04-291-0/+43
| | | | | | | (cherry-picked from 24d71ac70406f522fc1b09bf7c4025251ec3aee6) Fixes gh-4350 Closes gh-4354
* CSS: Don't automatically add "px" to properties with a few exceptionsMichał Gołębiowski-Owczarek2019-04-081-2/+80
| | | | | | Fixes gh-2795 Closes gh-4055 Ref gh-4009
* Build: Update Sinon from 2.3.7 to 7.3.1, other updatesMichał Gołębiowski-Owczarek2019-04-044-11/+11
| | | Closes gh-4341
* Tests: Make Android Browser 4.0-4.3 dimensions tests greenMichał Gołębiowski-Owczarek2019-03-271-2/+16
| | | | | | | | | | Android Browser disregards td's box-sizing, treating it like it was content-box. Unlike in IE, offsetHeight shares the same issue so there's no easy way to workaround the issue without incurring high size penalty. Let's at least check we get the size as the browser sees it. Also, fix the nearby support comment syntax. Closes gh-4335
* Tests: Make Android Browser 4.0-4.3 AJAX tests greenMichał Gołębiowski-Owczarek2019-03-271-1/+9
| | | | | | | Android Browser versions provided by BrowserStack fail the "prototype collision (constructor)" test while locally fired emulators don't, even when they connect to TestSwarm. Just skip the test there to avoid a red build. Closes gh-4334
* Core: Preserve CSP nonce on scripts with src attribute in DOM manipulationbuddh42019-03-251-0/+23
| | | | | Fixes gh-4323 Closes gh-4328
* Event: Prevent leverageNative from double-firing focusinRichard Gibson2019-03-251-5/+1
| | | | | | Also, reduce size. Closes gh-4329 Ref gh-4279
* Core: Prevent Object.prototype pollution for $.extend( true, ... )Michał Gołębiowski-Owczarek2019-03-251-0/+7
| | | Closes gh-4333
* Event: Leverage native events for focus/blur/click; propagate additional dataRichard Gibson2019-03-201-30/+133
| | | | | | | | | | | | | | | | | | | | | Summary of the changes/fixes: 1. Trigger checkbox and radio click events identically (cherry-picked from b442abacbb8464f0165059e8da734e3143d0721f that was reverted before). 2. Manually trigger a native event before checkbox/radio handlers. 3. Add test coverage for triggering namespaced native-backed events. 4. Propagate extra parameters passed when triggering the click event to the handlers. 5. Intercept and preserve namespaced native-backed events. 6. Leverage native events for focus and blur. 7. Accept that focusin handlers may fire more than once for now. Fixes gh-1741 Fixes gh-3423 Fixes gh-3751 Fixes gh-4139 Closes gh-4279 Ref gh-1367 Ref gh-3494
* CSS: Avoid forcing a reflow in width/height getters unless necessaryMichał Gołębiowski-Owczarek2019-03-181-8/+8
| | | | | | | | Fixes gh-4322 Closes gh-4325 Ref gh-3991 Ref gh-4010 Ref gh-4185 Ref gh-4187
* Build: Run the basic test suite in jsdomMichał Gołębiowski-Owczarek2019-03-111-1/+3
| | | | | | The basic test suite is now run in jsdom on all supported Node.js versions (8, 10 & 11 as of now). Closes gh-4310
* Build: Update QUnit from 1.23.1 to 2.9.2Michał Gołębiowski-Owczarek2019-03-045-12/+15
| | | Closes gh-4307
* Build: Update jsdom; migrate a test with Symbol polyfill to an iframe testMichał Gołębiowski-Owczarek2019-03-041-0/+11
| | | | | | | | | | | So far, we've been testing that jQuery element iteration works with polyfilled Symbol & transpiled for-of via a Node test with jsdom with the Symbol global removed. Unfortunately, jsdom now requires Symbol to be present for its internal functionality so such a test is no longer possible. Instead, it's been migrated to an iframe test with transpiled JavaScript. This PR also enables us to use ECMAScript 2017 or newer in Node.js code. Closes gh-4305
* Build: Update test code for compatibility with QUnit 2.x (#4297)abnud12019-02-1823-180/+256
| | | | | | | | Also, run `grunt npmcopy` to sync the "external" directory with dependencies from package.json. For example, the Sinon library version didn't match. Ref gh-4234 Closes gh-4297
* Core: Support passing nonce through jQuery.globalEvalMichał Gołębiowski-Owczarek2019-01-211-0/+23
| | | | | | Fixes gh-4278 Closes gh-4280 Ref gh-3541 Ref gh-4269
* Manipulation: Respect script nomodule attribute in DOM manipulationMichał Gołębiowski-Owczarek2019-01-211-1/+31
| | | | | | | | | | | | | PR #3869 added support for `<script type="module">` & some support for the `nomodule` attribute but with no tests for `nomodule` and with the attribute only respected on inline scripts. This commit adds support for source-based scripts as well. It also adds tests for `nomodule`, including making sure legacy browsers execute such scripts as they'd natively do - that's the whole point of `nomodule` scripts, after all. Fixes gh-4281 Closes gh-4282 Ref gh-3871 Ref gh-3869
* Tests: Skip nonce tests in old iOS/Android as wellMichał Gołębiowski-Owczarek2019-01-141-2/+5
| | | | | | | | | | Old iOS & Android Browser versions support script-src but not nonce, making the nonce test impossible to run. Browsers not supporting CSP at all are not a problem as they'll skip script-src restrictions completely. Ref gh-3541 Ref gh-4269 Ref c7c2855ed13f23322c4064407c1ed84561b95738