mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-19 13:41:10 +02:00
* Create app-footer component with tests * glimmerize vault route + controller * Add dev mode badge to new footer * Fix version on dashboard * update app-footer tests * update version title component * Handle case for chroot namespace fail on health check * cleanup * fix ent tests * add missing headers * extra version fetch on login success, clear version on logout and seal * Add coverage for clearing version on seal * rename isOSS to isCommunity * remove is-version helper * test version in footer on unseal flow * fix enterprise test * VAULT-21399 test coverage * VAULT-21400 test coverage
74 lines
2.7 KiB
JavaScript
74 lines
2.7 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { module, test } from 'qunit';
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
import { render, click } from '@ember/test-helpers';
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
import sinon from 'sinon';
|
|
|
|
module('Integration | Component | sidebar-frame', function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
test('it should hide and show sidebar', async function (assert) {
|
|
this.set('showSidebar', true);
|
|
await render(hbs`
|
|
<Sidebar::Frame @showSidebar={{this.showSidebar}} />
|
|
`);
|
|
assert.dom('[data-test-sidebar-nav]').exists('Sidebar renders');
|
|
|
|
this.set('showSidebar', false);
|
|
assert.dom('[data-test-sidebar-nav]').doesNotExist('Sidebar is hidden');
|
|
});
|
|
|
|
test('it should render link status, console ui panel and yield block for app content', async function (assert) {
|
|
const currentCluster = this.owner.lookup('service:currentCluster');
|
|
currentCluster.setCluster({ hcpLinkStatus: 'connected' });
|
|
const version = this.owner.lookup('service:version');
|
|
version.type = 'enterprise';
|
|
|
|
await render(hbs`
|
|
<Sidebar::Frame @showSidebar={{true}}>
|
|
<div class="page-container">
|
|
App goes here!
|
|
</div>
|
|
</Sidebar::Frame>
|
|
`);
|
|
|
|
assert.dom('[data-test-link-status]').exists('Link status component renders');
|
|
assert.dom('[data-test-component="console/ui-panel"]').exists('Console UI panel renders');
|
|
assert.dom('.page-container').exists('Block yields for app content');
|
|
});
|
|
|
|
test('it should render logo and actions in sidebar header', async function (assert) {
|
|
this.owner.lookup('service:currentCluster').setCluster({ name: 'vault' });
|
|
|
|
await render(hbs`
|
|
<Sidebar::Frame @showSidebar={{true}} />
|
|
`);
|
|
|
|
assert.dom('[data-test-sidebar-logo]').exists('Vault logo renders in sidebar header');
|
|
assert.dom('[data-test-console-toggle]').exists('Console toggle button renders in sidebar header');
|
|
await click('[data-test-console-toggle]');
|
|
assert.dom('.panel-open').exists('Console ui panel opens');
|
|
await click('[data-test-console-toggle]');
|
|
assert.dom('.panel-open').doesNotExist('Console ui panel closes');
|
|
assert.dom('[data-test-user-menu]').exists('User menu renders');
|
|
});
|
|
|
|
test('it should render namespace picker in sidebar footer', async function (assert) {
|
|
const version = this.owner.lookup('service:version');
|
|
version.features = ['Namespaces'];
|
|
const auth = this.owner.lookup('service:auth');
|
|
sinon.stub(auth, 'authData').value({});
|
|
|
|
await render(hbs`
|
|
<Sidebar::Frame @showSidebar={{true}} />
|
|
`);
|
|
|
|
assert.dom('.namespace-picker').exists('Namespace picker renders in sidebar footer');
|
|
});
|
|
});
|