2019-03-13 00:04:16 +00:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupRenderingTest } from 'ember-qunit';
|
2019-07-23 19:40:32 +00:00
|
|
|
import { find, click, render } from '@ember/test-helpers';
|
2018-07-26 22:36:07 +00:00
|
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
|
|
import { startMirage } from 'nomad-ui/initializers/ember-cli-mirage';
|
2020-08-25 15:56:02 +00:00
|
|
|
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
2018-07-26 22:36:07 +00:00
|
|
|
|
2019-03-13 00:04:16 +00:00
|
|
|
module('Integration | Component | page layout', function(hooks) {
|
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
|
|
|
hooks.beforeEach(function() {
|
2018-07-26 22:36:07 +00:00
|
|
|
this.server = startMirage();
|
2019-03-13 00:04:16 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
hooks.afterEach(function() {
|
2018-07-26 22:36:07 +00:00
|
|
|
this.server.shutdown();
|
2019-03-13 00:04:16 +00:00
|
|
|
});
|
2018-07-26 22:36:07 +00:00
|
|
|
|
2019-03-13 00:04:16 +00:00
|
|
|
test('the global-header hamburger menu opens the gutter menu', async function(assert) {
|
2020-06-01 19:03:56 +00:00
|
|
|
await render(hbs`<PageLayout />`);
|
2018-07-26 22:36:07 +00:00
|
|
|
|
2019-03-13 00:04:16 +00:00
|
|
|
assert.notOk(
|
|
|
|
find('[data-test-gutter-menu]').classList.contains('is-open'),
|
|
|
|
'Gutter menu is not open'
|
|
|
|
);
|
2019-07-23 19:40:32 +00:00
|
|
|
await click('[data-test-header-gutter-toggle]');
|
2018-07-26 22:36:07 +00:00
|
|
|
|
2019-07-23 19:40:32 +00:00
|
|
|
assert.ok(find('[data-test-gutter-menu]').classList.contains('is-open'), 'Gutter menu is open');
|
2020-08-25 15:56:02 +00:00
|
|
|
await componentA11yAudit(this.element, assert);
|
2018-07-26 22:36:07 +00:00
|
|
|
});
|
|
|
|
|
2019-03-13 00:04:16 +00:00
|
|
|
test('the gutter-menu hamburger menu closes the gutter menu', async function(assert) {
|
2020-06-01 19:03:56 +00:00
|
|
|
await render(hbs`<PageLayout />`);
|
2018-07-26 22:36:07 +00:00
|
|
|
|
2019-07-23 19:40:32 +00:00
|
|
|
await click('[data-test-header-gutter-toggle]');
|
2018-07-26 22:36:07 +00:00
|
|
|
|
2019-07-23 19:40:32 +00:00
|
|
|
assert.ok(find('[data-test-gutter-menu]').classList.contains('is-open'), 'Gutter menu is open');
|
|
|
|
await click('[data-test-gutter-gutter-toggle]');
|
|
|
|
|
|
|
|
assert.notOk(
|
|
|
|
find('[data-test-gutter-menu]').classList.contains('is-open'),
|
|
|
|
'Gutter menu is not open'
|
|
|
|
);
|
2019-03-13 00:04:16 +00:00
|
|
|
});
|
2018-07-26 22:36:07 +00:00
|
|
|
|
2019-03-13 00:04:16 +00:00
|
|
|
test('the gutter-menu backdrop closes the gutter menu', async function(assert) {
|
2020-06-01 19:03:56 +00:00
|
|
|
await render(hbs`<PageLayout />`);
|
2018-07-26 22:36:07 +00:00
|
|
|
|
2019-07-23 19:40:32 +00:00
|
|
|
await click('[data-test-header-gutter-toggle]');
|
2018-07-26 22:36:07 +00:00
|
|
|
|
2019-07-23 19:40:32 +00:00
|
|
|
assert.ok(find('[data-test-gutter-menu]').classList.contains('is-open'), 'Gutter menu is open');
|
|
|
|
await click('[data-test-gutter-backdrop]');
|
|
|
|
|
|
|
|
assert.notOk(
|
|
|
|
find('[data-test-gutter-menu]').classList.contains('is-open'),
|
|
|
|
'Gutter menu is not open'
|
|
|
|
);
|
2019-03-13 00:04:16 +00:00
|
|
|
});
|
2018-07-26 22:36:07 +00:00
|
|
|
});
|