mirror of
https://github.com/nasa/openmct.git
synced 2024-12-23 15:02:23 +00:00
Fixed failing MCTToolbarSpec
This commit is contained in:
parent
66e827de2e
commit
a023b0e19c
@ -30,6 +30,11 @@ define(
|
||||
var mockScope,
|
||||
mctToolbar;
|
||||
|
||||
function installController() {
|
||||
var Controller = mctToolbar.controller[1];
|
||||
return new Controller(mockScope);
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj("$scope", [ "$watch" ]);
|
||||
mockScope.$parent = {};
|
||||
@ -44,7 +49,7 @@ define(
|
||||
// mct-form needs to watch for the form by name
|
||||
// in order to convey changes in $valid, $dirty, etc
|
||||
// up to the parent scope.
|
||||
mctToolbar.controller(mockScope);
|
||||
installController();
|
||||
|
||||
expect(mockScope.$watch).toHaveBeenCalledWith(
|
||||
"mctForm",
|
||||
@ -56,7 +61,7 @@ define(
|
||||
var someState = { someKey: "some value" };
|
||||
mockScope.name = "someName";
|
||||
|
||||
mctToolbar.controller(mockScope);
|
||||
installController();
|
||||
|
||||
mockScope.$watch.mostRecentCall.args[1](someState);
|
||||
|
||||
@ -65,7 +70,7 @@ define(
|
||||
|
||||
it("allows strings to be converted to RegExps", function () {
|
||||
// This is needed to support ng-pattern in the template
|
||||
mctToolbar.controller(mockScope);
|
||||
installController();
|
||||
|
||||
// Should have added getRegExp to the scope,
|
||||
// to convert strings to regular expressions
|
||||
@ -78,7 +83,7 @@ define(
|
||||
regExp;
|
||||
|
||||
// Add getRegExp to scope
|
||||
mctToolbar.controller(mockScope);
|
||||
installController();
|
||||
regExp = mockScope.getRegExp(strRegExp);
|
||||
|
||||
// Same object instance each time...
|
||||
@ -91,7 +96,7 @@ define(
|
||||
var regExp = /^\d+[a-d]$/;
|
||||
|
||||
// Add getRegExp to scope
|
||||
mctToolbar.controller(mockScope);
|
||||
installController();
|
||||
|
||||
// Should have added getRegExp to the scope,
|
||||
// to convert strings to regular expressions
|
||||
@ -100,7 +105,7 @@ define(
|
||||
|
||||
it("passes a non-whitespace regexp when no pattern is defined", function () {
|
||||
// If no pattern is supplied, ng-pattern should match anything
|
||||
mctToolbar.controller(mockScope);
|
||||
installController();
|
||||
expect(mockScope.getRegExp()).toEqual(/\S/);
|
||||
expect(mockScope.getRegExp(undefined)).toEqual(/\S/);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user