-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Tests: Replace resource loader with AMD #1335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Initial PR based on #1029 |
//registered for it. Start with most specific name | ||
//and work up from it. | ||
for (i = syms.length; i > 0; i -= 1) { | ||
parentModule = sy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to use bower + bower_copy to place this file.
Better suggestions for the commit message? Actual: "Tests: Replace resource loader with AMD" |
"ui": "../../../ui" | ||
}, | ||
shim: { | ||
"jquery.simulate": [ "jquery" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What did we ever decide for jquery-color as far as UMD goes? The same would apply here to jquery-simulate. /cc @gnarf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just follow what UI has, unless you think it's reasonable to use in node.
Don't indent inside the define please. Creates an unnecessarily high number of changes, and is against the style guide: http://contribute.jquery.org/style-guide/js/#full-file-closures |
Absolutely... Fixed. |
"qunit/MIT-LICENSE.txt": "qunit/MIT-LICENSE.txt", | ||
"qunit/qunit.css": "qunit/qunit/qunit.css", | ||
"qunit/qunit.js": "qunit/qunit/qunit.js", | ||
"requirejs/require.js": "requirejs/require.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requirejs should be visually split from qunit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any preference on how to order it between qunits and jqueries? They are not in sort order... Should I use dependencies sort order, than jqueries? Whatever order is fine?
Still looks like a huge number of changes. Please squash the commits so that there aren't entries in the history having them changed and changed back. |
All |
@@ -134,6 +116,29 @@ <h3 class="bar">Rent one bear, ...</h3> | |||
</dd> | |||
</dl> | |||
|
|||
<script src="../../../external/requirejs/require.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did all of this move down? It's not even the end of the body, it's in the fixture.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was supposed to be in the end of the body
, not in the fixture div
(needs fix). Anyway, the reason for moving it down was to favor rendering of other elements of the page before loading and executing these scripts.
<script src="../helper/jquery.js"></script> | ||
<script> | ||
QUnit.config.autostart = false; | ||
require.config({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume we'd have the config defined somewhere else for re-use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeap, this will eventually get wrapped into a helper or something.
a113a9e
to
fc133d5
Compare
The next Qunit will no longer rely on test loading order for rerun functionality. We should wait till that lands and then re-revert the changes so we don't have to wrap all tests in an a fucntion to be executed later. |
I just tried to test this, by checking out the PR and opening Regarding execution order, the require.js docs say this:
So it shouldn't matter in what order the file content is loaded, in the end they're executed "in the right order". Since it doesn't define the semantics of "right order", this may not be what we're looking for. Since the current setup in this PR is broken, I can't really verify it here. |
e52a429
to
97813f7
Compare
I rebased this branch against master and fixed the failure (switching two lines, not sure how that happened). I've investigated if there's some way to load modules in the specified order without extra workarounds. The order only depends on other dependencies, but loading several files that have to dependencies to each other results in seemingly random order. Its actually not random, as far as I can tell its in the specified order, except when one of the modules loads a dependency not needed by the others, so here "accordion_core" is executed last, since it also loads "jquery-simulate". Anyway, one alternative to what @rxaviers implemented so far is nesting require(["./accordion_common"], function() {
require(["./accordion_core"], function() {
require(["./accordion_events"], function() {
require(["./accordion_methods"], function() {
require(["./accordion_options"], function() {
QUnit.start();
})
})
})
})
}); I'm hoping there's a better way. The above at least requires less modifications of our test files (no need for the separate wrapper) and could probably be abstracted so that we can still do this: requireTests([
"./accordion_common",
"./accordion_core",
"./accordion_events" ,
"./accordion_methods",
"./accordion_options"
], function() {
QUnit.start();
}); |
This was supposed to be in the end of the body, not in the fixture div
This reverts commit baa3378.
97813f7
to
cf94731
Compare
Updates:
|
- Port all others;
Update, I'm in the process of updating the tests of all other components. The problem I'm facing is that I get intermittent failures running datepicker tests |
onFocus(); | ||
}; | ||
|
||
element.bind( "focus", fn )[ 0 ].focus(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious. Should we replace [ 0 ]
with .first()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@c43500 Please reply using GitHub; your email replies have no formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rxaviers No. Doing that will likely break tests because you would be doing something different (triggering a focus event through jQuery instead of natively focusing the element).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Thanks
- Port all others;
- Port all others;
- Port all others;
Update. All tests are running. Some are failing (including the intermittent one described above). Need to:
|
To test swarminject: Log into Jenkins, create new job, pick some option to make it a copy of the existing jQuery UI (master) job, change branch from master to |
Can we smash all the files in var require = { ... }; Would also remove the need to export One issue I noticed when running datepicker tests: The order isn't consistent. JSHint tests used to run first, now they run at some point later, whatever the logic for that. I guess the problem is the I also get many errors on every other run of the datepicker tests. There seems to be a problem with Not sure yet what exactly is going on, hope that helps. Should have more time later. |
- Port all others;
- Port all others;
Sure, we can smash the helpers now that we know where each is used. Note I've updated the description with the remaining TODOs. |
- Port all others;
return; | ||
} | ||
|
||
require([ "jshint" ], function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this require
and instead have "jshint" under the test definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would load this when we don't need it. Just swap this with the line below.
Just swap this with the line below.
💥 WIP...
Pulll request's goal is to AMDify tests for 1.12.0 release and address part of http://bugs.jqueryui.com/ticket/10119.
TODO:
test/unit/helper/
files.