mirror of
https://github.com/nasa/openmct.git
synced 2025-06-05 09:00:49 +00:00
[Autocomplete] Update test
This commit is contained in:
parent
f20c8b7d99
commit
504b2e1ecf
@ -20,19 +20,26 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
define(
|
define([
|
||||||
["../../src/controllers/AutocompleteController"],
|
"../../src/controllers/AutocompleteController",
|
||||||
function (AutocompleteController) {
|
"angular"
|
||||||
|
], function (
|
||||||
|
AutocompleteController,
|
||||||
|
angular
|
||||||
|
) {
|
||||||
|
|
||||||
describe("The autocomplete controller", function () {
|
describe("The autocomplete controller", function () {
|
||||||
var mockScope,
|
var mockScope,
|
||||||
|
mockElement,
|
||||||
controller;
|
controller;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockScope = jasmine.createSpyObj("$scope", ["$watch"]);
|
mockScope = jasmine.createSpyObj("$scope", ["$watch"]);
|
||||||
mockScope.options = ['Asia/Dhaka', 'UTC', 'Toronto', 'Asia/Shanghai', 'Hotel California'];
|
mockScope.options = ['Asia/Dhaka', 'UTC', 'Toronto', 'Asia/Shanghai', 'Hotel California'];
|
||||||
mockScope.ngModel = [null, null, null, null, null];
|
mockScope.ngModel = [null, null, null, null, null];
|
||||||
controller = new AutocompleteController(mockScope);
|
mockScope.field = 4;
|
||||||
|
mockElement = angular.element("<div></div>");
|
||||||
|
controller = new AutocompleteController(mockScope, mockElement);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("makes optionNames array equal to options if options is an array of string", function () {
|
it("makes optionNames array equal to options if options is an array of string", function () {
|
||||||
@ -50,7 +57,7 @@ define(
|
|||||||
var str = "UTC";
|
var str = "UTC";
|
||||||
mockScope.fillInput(str);
|
mockScope.fillInput(str);
|
||||||
expect(mockScope.hideOptions).toEqual(true);
|
expect(mockScope.hideOptions).toEqual(true);
|
||||||
expect(mockScope.ngModel[4]).toEqual(str);
|
expect(mockScope.ngModel[mockScope.field]).toEqual(str);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("sets a new optionIndex on mouse hover", function () {
|
it("sets a new optionIndex on mouse hover", function () {
|
||||||
@ -59,5 +66,4 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user