Charlie Tran 843a6c5bbb
feat(frontend): update datahub-web client UI code (#1806)
* 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
2020-08-26 15:44:50 -07:00

66 lines
2.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { INotification } from '@datahub/utils/types/notifications/service';
import { NotificationEvent, NotificationType } from '@datahub/utils/constants/notifications';
import { noop } from 'lodash';
const toastBaseClass = '.notifications__toast';
const makeToast: (props?: { content?: string }) => INotification = (props = { content: 'Success!' }) => ({
props: {
type: NotificationEvent.success,
content: props.content
},
type: NotificationType.Toast,
notificationResolution: {
createPromiseToHandleThisNotification: () => Promise.resolve()
}
});
module('Integration | Component | notifications-toast', function(hooks): void {
setupRenderingTest(hooks);
test('toast rendering', async function(assert): Promise<void> {
this.set('onDismiss', noop);
await render(hbs`<NotificationsToast @onDismiss={{this.onDismiss}}/>`);
assert.dom(toastBaseClass).exists();
assert.dom(`${toastBaseClass}__dismiss`).hasText('×');
await render(hbs`
<NotificationsToast @onDismiss={{this.onDismiss}} as |Toast|>
{{Toast.content}}
</NotificationsToast>`);
assert.dom(`${toastBaseClass}__content__msg`).exists();
});
test('toast property rendering', async function(assert): Promise<void> {
const fakeToast = makeToast();
const { content = '' } = fakeToast.props;
this.setProperties({ onDismiss: noop, toast: fakeToast });
await render(hbs`<NotificationsToast @onDismiss={{this.onDismiss}} @toast={{this.toast}}/>`);
assert.dom(`${toastBaseClass}__content--success`).exists();
assert.dom(`${toastBaseClass}__content__msg`).hasText(content);
});
test('toast content truncation and content detail', async function(assert): Promise<void> {
const fakeToast = makeToast({
content:
'A long string of text for user notification that contains more than the required number of characters to be displayed in a toast'
});
this.setProperties({ onDismiss: noop, toast: fakeToast });
await render(
hbs`<NotificationsToast @onDismiss={{this.onDismiss}} @toast={{this.toast}} @onShowDetail={{this.onDismiss}} />`
);
assert
.dom(`${toastBaseClass}__content__msg`)
.hasText('A long string of text for user notification that...number of characters to be displayed in a toast');
assert.dom(`${toastBaseClass}__content-detail`).hasText('See Detail');
});
});