mirror of
https://github.com/nasa/openmct.git
synced 2025-06-23 17:53:28 +00:00
[Mobile] Test BrowseTreeController variants
This commit is contained in:
@ -21,23 +21,33 @@
|
||||
*****************************************************************************/
|
||||
/*global define,Promise*/
|
||||
|
||||
/**
|
||||
* This bundle implements Browse mode.
|
||||
* @namespace platform/commonUI/browse
|
||||
*/
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
|
||||
/**
|
||||
* Controller to provide the ability to show/hide the tree in
|
||||
* Browse mode.
|
||||
* @constructor
|
||||
* @memberof platform/commonUI/browse
|
||||
*/
|
||||
function BrowseTreeController() {
|
||||
this.state = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the visibility of the tree.
|
||||
*/
|
||||
BrowseTreeController.prototype.toggle = function () {
|
||||
this.state = !this.state;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the desired visibility state of the tree.
|
||||
* @returns {boolean} true when visible
|
||||
*/
|
||||
BrowseTreeController.prototype.visible = function () {
|
||||
return this.state;
|
||||
};
|
||||
|
@ -24,5 +24,20 @@
|
||||
define(
|
||||
["../src/BrowseTreeController"],
|
||||
function (BrowseTreeController) {
|
||||
'use strict';
|
||||
describe("The BrowseTreeController", function () {
|
||||
var controller = new BrowseTreeController();
|
||||
|
||||
it("is initially visible", function () {
|
||||
expect(controller.visible()).toBeTruthy();
|
||||
});
|
||||
|
||||
it("allows visibility to be toggled", function () {
|
||||
controller.toggle();
|
||||
expect(controller.visible()).toBeFalsy();
|
||||
controller.toggle();
|
||||
expect(controller.visible()).toBeTruthy();
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user