Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
feat(protractor): add removeMockModule method
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Jeurissen authored and juliemr committed Feb 15, 2014
1 parent 71c9a07 commit 642de06
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/protractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,16 @@ Protractor.prototype.clearMockModules = function() {
this.moduleScripts_ = [];
};

/**
* Remove a registered mock module.
* @param {!string} name The name of the module to remove.
*/
Protractor.prototype.removeMockModule = function (name) {
var index = this.moduleNames_.indexOf(name);
this.moduleNames_.splice(index, 1);
this.moduleScripts_.splice(index, 1);
};

/**
* See webdriver.WebDriver.get
*
Expand Down
12 changes: 12 additions & 0 deletions spec/basic/mockmodule_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,16 @@ describe('mock modules', function() {

expect(element(by.css('[app-version]')).getText()).toEqual('3');
});

it('should have the version of the module A after deleting module B', function() {
browser.addMockModule('moduleA', mockModuleA);
browser.addMockModule('moduleB', mockModuleB);

browser.removeMockModule('moduleB');

browser.get('index.html');

expect(element(by.css('[app-version]')).getText()).toEqual('2');
});

});

0 comments on commit 642de06

Please sign in to comment.