#32688 closed task (blessed) (fixed)
Customizer Menus: add QUnit tests
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.3 | Priority: | high |
Severity: | normal | Version: | 4.3 |
Component: | Customize | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
The Customizer Menus feature needs QUnit tests.
Moved from https://github.com/voldemortensen/menu-customizer/issues/68
Attachments (8)
Change History (28)
#7
@
10 years ago
I'm working on getting some tests here, though it would be really helpful if someone more intimate with this code wrote them. My above patch starts adding the code needed to run tests without actually adding any tests. That's next. Hints, tips and pointers are appreciated.
#8
@
10 years ago
Thanks @jorbin for getting this started. I'm going to start writing some tests!
In 32688.3.diff:
- Add test to verify that
generatePlaceholderAutoIncrementId
generates unique IDs - Add some more setup steps, include menu customizer, add window.wpNavMenu setup
Replying to jorbin:
I'm working on getting some tests here, though it would be really helpful if someone more intimate with this code wrote them. My above patch starts adding the code needed to run tests without actually adding any tests. That's next. Hints, tips and pointers are appreciated.
#9
@
10 years ago
I am getting this cleaned up so we can get some tests added now. I think the next step needs to be testing some of the api.Menus.MenuItemControl
pieces, such as move left, move right, move up, and move down. _changeDepth and _changePosition both throw errors, we should use throws to make sure that they are properly thrown when those error conditions exist.
#11
follow-up:
↓ 13
@
10 years ago
Above patch continues to spec out the fixture and adds an additional test, however it also causes many of the existing panel and settings tests to fail.
This ticket was mentioned in Slack in #core by mark. View the logs.
10 years ago
#13
in reply to:
↑ 11
@
10 years ago
Replying to jorbin:
Above patch continues to spec out the fixture and adds an additional test, however it also causes many of the existing panel and settings tests to fail.
Trivial fix for this in 32688.6.diff: we just have to extend the window._wpCustomizeSettings.sections
object instead of overriding it.
PR with all patches: https://github.com/xwp/wordpress-develop/pull/107
@
10 years ago
Additional changes: https://github.com/xwp/wordpress-develop/compare/3443f08...8ade858
#14
@
10 years ago
In 32688.7.diff: flesh out fixtures for nav menus and add test for non-empty menus, add todos for tests, remove setup/teardown resets for now.
@
10 years ago
Additional changes: https://github.com/xwp/wordpress-develop/compare/8ade858...3fe53c2a
#15
@
10 years ago
- Keywords has-patch added; needs-patch removed
Well, I feel like 32688.8.diff may be as far as we can take QUnit tests for Menu Customizer in 4.3. Beside the limited time left, the Menu Customizer functionality really begs for integration/acceptance tests and not pure unit tests (even the PHPUnit tests in Core are often not pure unit tests either). I think what we really need to fully test the Customizer is a testing approach that has a real environment (i.e. the vanilla environment created for initial PHPUnit test state) which allows JS to access data provided by PHP at page load time, *and* via Ajax requests, and evaluate the ability to perform end-to-end workflow operations on menus in the Customizer. This is something I've talked about with @jorbin to start writing Selenium scripts to run through the Customizer in the various acceptance tests.
So I suggest that the patch here be committed and we close this out to then turn focus in JS testing to writing acceptance tests.
#16
@
10 years ago
@ocean90, @markjaquith, can @westonruter get the go-ahead here? It would be nice to have that fixed with RC2.
#17
@
10 years ago
Yeah, go for it. Passing tests should always be good to go, as they don't affect /build/
.
Who's up for tackling these?