mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-12 03:07:05 +00:00

* Releases updated version of datahub-web client UI code * Fix typo in yarn lock * Change yarn lock to match yarn registry directories * Previous commit missed some paths * Even more changes to yarnlock missing in previous commit * Include codegen file for typings * Add files to get parity for datahub-web and current OS datahub-midtier * Add in typo fix from previous commit - change to proper license * Implement proper OS fix for person entity picture url * Workarounds for open source DH issues * Fixes institutional memory api and removes unopensourced tabs for datasets * Fixes search dataset deprecation and user search issue as a result of changes * Remove internal only options in the avatar menu
62 lines
2.1 KiB
TypeScript
62 lines
2.1 KiB
TypeScript
import { module, test } from 'qunit';
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
import { render } from '@ember/test-helpers';
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
import { baseClass, PREVIEW_LIMIT } from '@datahub/shared/components/top-consumers/insight/insight-card';
|
|
import { IDynamicLinkParams } from 'dynamic-link/components/dynamic-link';
|
|
import { TopConsumer } from '@datahub/metadata-types/constants/metadata/top-consumers';
|
|
|
|
module('Integration | Component | top-consumers/insight/insight-card', function(hooks): void {
|
|
setupRenderingTest(hooks);
|
|
|
|
test('it renders and behaves as expected', async function(assert): Promise<void> {
|
|
const title = 'test title';
|
|
const testLink = 'https://linkedin.com';
|
|
const testText = 'linkedin';
|
|
|
|
const topConsumerLinkParam: IDynamicLinkParams = {
|
|
href: testLink,
|
|
text: testText
|
|
};
|
|
|
|
const topConsumers = new Array(10).fill(topConsumerLinkParam);
|
|
|
|
this.setProperties({
|
|
title,
|
|
topConsumers,
|
|
consumerType: TopConsumer.GROUP
|
|
});
|
|
|
|
await render(hbs`
|
|
<TopConsumers::Insight::InsightCard
|
|
@title={{this.title}}
|
|
@topConsumers={{this.topConsumers}}
|
|
@consumerType={{this.consumerType}}
|
|
/>
|
|
`);
|
|
|
|
const insightClassSelector = `.${baseClass}`;
|
|
const insightTitleClassSelector = `.${baseClass}__title`;
|
|
const insightItemClassSelector = `${baseClass}__item`;
|
|
const showMoreClassSelector = `.${baseClass}__show-more`;
|
|
|
|
assert.dom(insightClassSelector).exists();
|
|
assert.dom(insightTitleClassSelector).hasText(title);
|
|
|
|
assert.equal(
|
|
document.getElementsByClassName(insightItemClassSelector).length,
|
|
PREVIEW_LIMIT,
|
|
'Expected number of items rendered to be equal to the preview limit'
|
|
);
|
|
|
|
const numberOfItemsHidden = topConsumers.length - PREVIEW_LIMIT;
|
|
assert.dom(showMoreClassSelector).hasText(`${numberOfItemsHidden} more`);
|
|
|
|
assert.equal(
|
|
document.querySelector(`.${insightItemClassSelector}`)?.getAttribute('href'),
|
|
testLink,
|
|
'Expects the insight card to render the correct link'
|
|
);
|
|
});
|
|
});
|