You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
angularjs-batarang/test/OptionsCtrlSpec.js

56 lines
1.6 KiB
JavaScript

describe('panelApp', function () {
beforeEach(module('panelApp'));
beforeEach(module(function($provide) {
$provide.factory('chromeExtension', createChromeExtensionMock);
$provide.factory('appContext', createAppContextMock);
}));
describe('OptionsCtrl', function() {
var ctrl, $scope, appContext, chromeExtension;
beforeEach(inject(function(_$rootScope_, _appContext_, _chromeExtension_, $controller) {
$scope = _$rootScope_;
chromeExtension = _chromeExtension_;
appContext = _appContext_;
ctrl = $controller('OptionsCtrl', {$scope: $scope});
}));
it('should initialize debug state to false and send request to chrome', function () {
expect($scope.debugger.scopes).toBe(false);
expect($scope.debugger.bindings).toBe(false);
$scope.$digest();
});
// TODO: test that window is mutated appropriately
/*
it('should notify chrome of state changes to the showScopes option', function () {
$scope.$digest();
chromeExtension.sendRequest.reset();
$scope.debugger.scopes = true;
$scope.$digest();
expect(chromeExtension.sendRequest).toHaveBeenCalledWith('showScopes');
});
it('should notify chrome of state changes to the showBindings option', function () {
$scope.$digest();
chromeExtension.sendRequest.reset();
$scope.debugger.bindings = true;
$scope.$digest();
expect(chromeExtension.sendRequest).toHaveBeenCalledWith('showBindings');
});
*/
it('should not refresh upon initial panel load', function () {
$scope.$digest();
expect(appContext.setDebug).not.toHaveBeenCalled();
});
});
});