open-vault/ui/tests/integration/components/page/breadcrumbs-test.js
Hamid Ghaf 27bb03bbc0
adding copyright header (#19555)
* adding copyright header

* fix fmt and a test
2023-03-15 09:00:52 -07:00

32 lines
1 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
/* eslint-disable ember/no-private-routing-service */
import { module, test } from 'qunit';
import { setupRenderingTest } from 'vault/tests/helpers';
import { findAll, render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | page/breadcrumbs', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
this.breadcrumbs = [
{ label: 'Home', route: 'home', linkExternal: true },
{ label: 'Details', route: 'home.details' },
{ label: 'Edit item' },
];
await render(hbs`<Page::Breadcrumbs @breadcrumbs={{this.breadcrumbs}} />`);
assert.dom('[data-test-breadcrumbs]').exists('renders passed in breadcrumbs');
assert.strictEqual(findAll('[data-test-breadcrumbs] li').length, 3, 'it renders 3 breadcrumbs');
assert.strictEqual(
findAll('[data-test-breadcrumbs] a').length,
2,
'it does not render a link if no path'
);
});
});