Page MenuHomePhabricator

Make require and define functions on mw.mobileFrontend testable
Closed, ResolvedPublic

Description

Author: jgonera

Description:
Currently mobileFrontend is an object which persists state but can't be easily reinitialized. This makes unit testing more difficult (tests are not atomic), e.g.:

Unit test 1

  • M.define( 'testModule', ... );
  • checks that calling M.define( 'testModule', ... ) again throws an error saying that module exists.

Unit test 2

  • M.define( 'testModule', ... ); <--- FAILS here because the previous test already defined 'testModule' and M is not reinitialized
  • checks if M.require( 'testModule' ) returns what we just defined

Version: unspecified
Severity: normal

Details

Reference
bz44264
Related Gerrit Patches:
mediawiki/extensions/MobileFrontend : masterAdd tests for define and require methods
mediawiki/extensions/Mantle : masterAdd tests for define and require methods

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:34 AM
bzimport set Reference to bz44264.
bzimport created this task.Jan 23 2013, 1:16 AM

Change 182298 had a related patch set uploaded (by Jdlrobson):
Add tests for define and require methods

https://gerrit.wikimedia.org/r/182298

Patch-For-Review

Change 182968 had a related patch set uploaded (by Jdlrobson):
Add tests for define and require methods

https://gerrit.wikimedia.org/r/182968

Patch-For-Review

Change 182298 abandoned by Jdlrobson:
Add tests for define and require methods

Reason:
See https://gerrit.wikimedia.org/r/182968

https://gerrit.wikimedia.org/r/182298

Jdlrobson renamed this task from Make mobileFrontend an object created with "new" to Make require and define functions on mw.mobileFrontend testable.Jan 8 2015, 10:07 PM
Jdlrobson updated the task description. (Show Details)

Change 182968 merged by jenkins-bot:
Add tests for define and require methods

https://gerrit.wikimedia.org/r/182968

Jdlrobson closed this task as Resolved.Jan 9 2015, 9:16 PM