angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.spec.ts
AleksanderBodurri 2a1ff17b42 refactor(devtools): run tslint --fix on devtools codebase
This commit runs tslint --fix with the angular/angular tslint configuration on the files inside the devtools codebase.

Notably, the file-header rule in `tslint.json` was missing a default attribute. This commit adds that default attribute and sets it to the
license header that is present in all files in this repo. After running tslint --fix with this default added, this commit added the license header to all files in the devtools directory. Note for the reviewer: the automatically added license headers were added as comments with the "/*!" prefix. Since we want these comments removed in builds, and the rest of the codebase uses "/**", a simple find and replace was performed on the devtools directory to change these prefixes to "/**".
2022-01-26 16:35:31 -05:00

52 lines
1.8 KiB
TypeScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Events, MessageBus} from 'protocol';
import {ApplicationEnvironment} from '../application-environment/index';
import {DevToolsTabsComponent} from './devtools-tabs.component';
import {TabUpdate} from './tab-update/index';
describe('DevtoolsTabsComponent', () => {
let messageBusMock: MessageBus<Events>;
let applicationEnvironmentMock: ApplicationEnvironment;
let comp: DevToolsTabsComponent;
let mockThemeService: any;
beforeEach(() => {
messageBusMock = jasmine.createSpyObj('messageBus', ['on', 'once', 'emit', 'destroy']);
applicationEnvironmentMock = jasmine.createSpyObj('applicationEnvironment', ['environment']);
mockThemeService = {};
comp = new DevToolsTabsComponent(
new TabUpdate(), mockThemeService as any, messageBusMock, applicationEnvironmentMock);
});
it('should create instance from class', () => {
expect(comp).toBeTruthy();
});
it('toggles inspector flag', () => {
expect(comp.inspectorRunning).toBe(false);
comp.toggleInspectorState();
expect(comp.inspectorRunning).toBe(true);
comp.toggleInspectorState();
expect(comp.inspectorRunning).toBe(false);
});
it('emits inspector event', () => {
comp.toggleInspector();
expect(messageBusMock.emit).toHaveBeenCalledTimes(1);
expect(messageBusMock.emit).toHaveBeenCalledWith('inspectorStart');
comp.toggleInspector();
expect(messageBusMock.emit).toHaveBeenCalledTimes(3);
expect(messageBusMock.emit).toHaveBeenCalledWith('inspectorEnd');
expect(messageBusMock.emit).toHaveBeenCalledWith('removeHighlightOverlay');
});
});