2016-08-02 14:38:13 -06:00
|
|
|
// Copyright 2016 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2016-08-10 09:43:06 -06:00
|
|
|
import {HamburgerElement, HeadingElement, SidebarElement, main} from './main';
|
2016-08-02 14:38:13 -06:00
|
|
|
|
2016-08-04 12:24:04 -06:00
|
|
|
describe('main', () => {
|
2016-08-02 14:38:13 -06:00
|
|
|
it('sets the document\'s title', () => {
|
|
|
|
main();
|
|
|
|
expect(document.title).toBe('Go Heap Viewer');
|
|
|
|
});
|
2016-08-04 12:24:04 -06:00
|
|
|
|
|
|
|
it('has a heading', () => {
|
|
|
|
main();
|
2016-08-10 09:43:06 -06:00
|
|
|
expect(document.querySelector(HeadingElement.NAME)).toBeDefined();
|
2016-08-04 12:24:04 -06:00
|
|
|
});
|
2016-08-10 09:43:06 -06:00
|
|
|
|
|
|
|
it('has a sidebar', () => {
|
|
|
|
main();
|
|
|
|
const hamburger = document.querySelector(HamburgerElement.NAME);
|
|
|
|
const sidebar =
|
|
|
|
document.querySelector(SidebarElement.NAME) as SidebarElement;
|
|
|
|
expect(sidebar.style.display).toBe('none');
|
|
|
|
|
|
|
|
// Click on the hamburger. Sidebar should then be visible.
|
|
|
|
hamburger.dispatchEvent(new Event('click'));
|
|
|
|
expect(sidebar.style.display).toBe('block');
|
|
|
|
})
|
2016-08-02 14:38:13 -06:00
|
|
|
});
|