vault/ui/tests/integration/components/sidebar/frame-test.js
hashicorp-copywrite[bot] 0b12cdcfd1
[COMPLIANCE] License changes (#22290)
* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Updating the license from MPL to Business Source License.

Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl.

* add missing license headers

* Update copyright file headers to BUS-1.1

* Fix test that expected exact offset on hcl file

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Sarah Thompson <sthompson@hashicorp.com>
Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
2023-08-10 18:14:03 -07:00

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.version = '1.13.0-dev1+ent';
await render(hbs`
<Sidebar::Frame @showSidebar={{true}}>
<div class="page-container">
App goes here!
</div>
</Sidebar::Frame>
`);
assert.dom('.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');
});
});