5c2a08de6d
* Update browserslist * Add browserslistrc * ember-cli-update --to 3.26, fix conflicts * Run codemodes that start with ember-* * More codemods - before cp* * More codemods (curly data-test-*) * WIP ember-basic-dropdown template errors * updates ember-basic-dropdown and related deps to fix build issues * updates basic dropdown instances to new version API * updates more deps -- ember-template-lint is working again * runs no-implicit-this codemod * creates and runs no-quoteless-attributes codemod * runs angle brackets codemod * updates lint:hbs globs to only touch hbs files * removes yield only templates * creates and runs deprecated args transform * supresses lint error for invokeAction on LinkTo component * resolves remaining ambiguous path lint errors * resolves simple-unless lint errors * adds warnings for deprecated tagName arg on LinkTo components * adds warnings for remaining curly component invocation * updates global template lint rules * resolves remaining template lint errors * disables some ember specfic lint rules that target pre octane patterns * js lint fix run * resolves remaining js lint errors * fixes test run * adds npm-run-all dep * fixes test attribute issues * fixes console acceptance tests * fixes tests * adds yield only wizard/tutorial-active template * fixes more tests * attempts to fix more flaky tests * removes commented out settled in transit test * updates deprecations workflow and adds initializer to filter by version * updates flaky policies acl old test * updates to flaky transit test * bumps ember deps down to LTS version * runs linters after main merge * fixes client count tests after bad merge conflict fixes * fixes client count history test * more updates to lint config * another round of hbs lint fixes after extending stylistic rule * updates lint-staged commands * removes indent eslint rule since it seems to break things * fixes bad attribute in transform-edit-form template * test fixes * fixes enterprise tests * adds changelog * removes deprecated ember-concurrency-test-waiters dep and adds @ember/test-waiters * flaky test fix Co-authored-by: hashishaw <cshaw@hashicorp.com>
86 lines
2.5 KiB
JavaScript
86 lines
2.5 KiB
JavaScript
import { module, test } from 'qunit';
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
import { render } from '@ember/test-helpers';
|
|
import { hbs } from 'ember-cli-htmlbars';
|
|
|
|
module('Integration | Component | bar-chart', function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
test('it renders', async function (assert) {
|
|
let dataset = [
|
|
{
|
|
namespace_id: 'root',
|
|
namespace_path: 'root',
|
|
counts: {
|
|
distinct_entities: 268,
|
|
non_entity_tokens: 985,
|
|
clients: 1253,
|
|
},
|
|
},
|
|
{
|
|
namespace_id: 'O0i4m',
|
|
namespace_path: 'top-namespace',
|
|
counts: {
|
|
distinct_entities: 648,
|
|
non_entity_tokens: 220,
|
|
clients: 868,
|
|
},
|
|
},
|
|
{
|
|
namespace_id: '1oihz',
|
|
namespace_path: 'anotherNamespace',
|
|
counts: {
|
|
distinct_entities: 547,
|
|
non_entity_tokens: 337,
|
|
clients: 884,
|
|
},
|
|
},
|
|
{
|
|
namespace_id: '1oihz',
|
|
namespace_path: 'someOtherNamespaceawgagawegawgawgawgaweg',
|
|
counts: {
|
|
distinct_entities: 807,
|
|
non_entity_tokens: 234,
|
|
clients: 1041,
|
|
},
|
|
},
|
|
];
|
|
|
|
let flattenData = () => {
|
|
return dataset.map((d) => {
|
|
return {
|
|
label: d['namespace_path'],
|
|
non_entity_tokens: d['counts']['non_entity_tokens'],
|
|
distinct_entities: d['counts']['distinct_entities'],
|
|
total: d['counts']['clients'],
|
|
};
|
|
});
|
|
};
|
|
|
|
this.set('title', 'Top Namespaces');
|
|
this.set('description', 'Each namespaces client count includes clients in child namespaces.');
|
|
this.set('dataset', flattenData());
|
|
|
|
await render(hbs`
|
|
<BarChart
|
|
@title={{this.title}}
|
|
@description={{this.description}}
|
|
@dataset={{this.dataset}}
|
|
@mapLegend={{array
|
|
(hash key="non_entity_tokens" label="Active direct tokens")
|
|
(hash key="distinct_entities" label="Unique Entities")}}
|
|
>
|
|
<button type="button" class="link">
|
|
Export all namespace data
|
|
</button>
|
|
</BarChart>
|
|
`);
|
|
assert.dom('[data-test-bar-chart]').exists('bar chart renders');
|
|
assert.dom('[data-test-bar-chart] .chart-title').hasText('Top Namespaces', 'displays title');
|
|
assert
|
|
.dom('[data-test-bar-chart] .chart-description')
|
|
.hasText('Each namespaces client count includes clients in child namespaces.', 'displays description');
|
|
assert.dom('.data-bar').exists({ count: 8 }, 'bars render');
|
|
});
|
|
});
|