Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Build: Make Karma work in AMD mode
Also, run such a suite in CI to make sure modules are working as expected when used directly. (partially cherry picked from 341c6d1) (partially cherry picked from 437f389) Closes gh-4595 Ref gh-4550 Ref gh-4574
- Loading branch information
Showing
9 changed files
with
183 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,45 +1,43 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en" id="html"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title>CONTEXT</title> | ||
| <!-- Karma serves this page from /context.html. Other files are served from /base --> | ||
| <link rel="stylesheet" href="/base/test/data/testsuite.css" /> | ||
| <meta charset="utf-8"> | ||
| <title>CONTEXT</title> | ||
| <!-- Karma serves this page from /context.html. Other files are served from /base --> | ||
| <link rel="stylesheet" href="/base/test/data/testsuite.css" /> | ||
| </head> | ||
| <body id="body"> | ||
| <div id="qunit"></div> | ||
| <div id="qunit"></div> | ||
|
|
||
| <!-- Start: jQuery Test HTML --> | ||
| <!-- this iframe is outside the #qunit-fixture so it won't waste time by constantly reloading; the tests are "safe" and clean up after themselves --> | ||
| <iframe id="loadediframe" name="loadediframe" style="display:none;" src="/base/test/data/iframe.html"></iframe> | ||
| <div id="qunit-fixture"></div> | ||
| <!-- End: jQuery Test HTML --> | ||
| <!-- Start: jQuery Test HTML --> | ||
| <!-- this iframe is outside the #qunit-fixture so it won't waste time by constantly reloading; the tests are "safe" and clean up after themselves --> | ||
| <iframe id="loadediframe" name="loadediframe" style="display:none;" src="/base/test/data/iframe.html"></iframe> | ||
| <div id="qunit-fixture"></div> | ||
| <!-- End: jQuery Test HTML --> | ||
|
|
||
| <!-- Start: Karma boilerplate --> | ||
| <script src="/context.js"></script> | ||
| <script> | ||
| %CLIENT_CONFIG% | ||
| window.__karma__.setupContext(window); | ||
| <!-- Start: Karma boilerplate --> | ||
| <script src="/context.js"></script> | ||
| <script> | ||
| %CLIENT_CONFIG% | ||
| window.__karma__.setupContext(window); | ||
|
|
||
| %MAPPINGS% | ||
| </script> | ||
| %SCRIPTS% | ||
| <!-- End: Karma boilerplate --> | ||
| %MAPPINGS% | ||
| </script> | ||
| %SCRIPTS% | ||
| <!-- End: Karma boilerplate --> | ||
|
|
||
| <script src="/base/test/data/qunit-fixture.js"></script> | ||
| <script> | ||
| // Workaround: Remove call to window.__karma__.loaded() | ||
| // in favour of calling window.__karma__.start() at window.onload | ||
| // because tests such as unit/ready.js should run after document ready | ||
| window.addEventListener('load', function() { | ||
| window.__karma__.start(); | ||
| <script src="/base/test/data/qunit-fixture.js"></script> | ||
| <script> | ||
| // QUnit.config is populated from QUnit.urlParams but only at the beginning | ||
| // of the test run. We need to read both. | ||
| var amd = QUnit.config.amd || QUnit.urlParams.amd; | ||
|
|
||
| // Workaround: https://github.com/karma-runner/karma-qunit/issues/92 | ||
| QUnit.testStart(function () { | ||
| // Restore content | ||
| document.getElementById("qunit-fixture").innerHTML = QUnit.config.fixture; | ||
| }); | ||
| }); | ||
| </script> | ||
| // Workaround: Remove call to `window.__karma__.loaded()` | ||
| // in favour of calling `window.__karma__.start()` from `loadTests()` | ||
| // because tests such as unit/ready.js should run after document ready. | ||
| if ( !amd ) { | ||
| loadTests(); | ||
| } | ||
| </script> | ||
| </body> | ||
| </html> |
Oops, something went wrong.