mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-11 10:46:52 +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
66 lines
2.3 KiB
TypeScript
66 lines
2.3 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 { IMailHeaderRecord } from '@datahub/utils/helpers/email';
|
|
|
|
module('Integration | Component | mail-to', function(hooks): void {
|
|
setupRenderingTest(hooks);
|
|
|
|
test('it renders', async function(assert): Promise<void> {
|
|
const noRecipient = 'No email found';
|
|
let mailHeader: IMailHeaderRecord = {};
|
|
|
|
this.setProperties({ mailHeader });
|
|
|
|
await render(hbs`
|
|
<MailTo />
|
|
`);
|
|
|
|
assert.dom(this.element).hasText('No email found', `Expected rendered text to be ${noRecipient}`);
|
|
assert.dom('a').exists('Expected an anchor element to be rendered in the DOM');
|
|
assert.dom('a').hasAttribute('rel', 'noreferrer noopener');
|
|
assert.dom('a').hasAttribute('target', '_blank');
|
|
|
|
await render(hbs`
|
|
<MailTo @mailHeader={{this.mailHeader}} @handler="" />
|
|
`);
|
|
|
|
assert
|
|
.dom(this.element)
|
|
.hasText('No email found', `Expected ${noRecipient} to be rendered text when an empty mail header is found`);
|
|
|
|
mailHeader = { ...mailHeader, to: 'email@example.com' };
|
|
this.set('mailHeader', mailHeader);
|
|
assert.dom('a').hasAttribute('href', 'mailto:email%40example.com');
|
|
|
|
mailHeader = { ...mailHeader, subject: 'An email subject' };
|
|
this.set('mailHeader', mailHeader);
|
|
assert.dom('a').hasAttribute('href', 'mailto:email%40example.com?subject=An+email+subject');
|
|
|
|
mailHeader = { ...mailHeader, cc: 'A carbon copy' };
|
|
this.set('mailHeader', mailHeader);
|
|
assert.dom('a').hasAttribute('href', 'mailto:email%40example.com?subject=An+email+subject&cc=A+carbon+copy');
|
|
|
|
mailHeader = { ...mailHeader, bcc: 'A blind carbon copy' };
|
|
this.set('mailHeader', mailHeader);
|
|
assert
|
|
.dom('a')
|
|
.hasAttribute(
|
|
'href',
|
|
'mailto:email%40example.com?subject=An+email+subject&cc=A+carbon+copy&bcc=A+blind+carbon+copy'
|
|
);
|
|
|
|
await render(hbs`
|
|
<MailTo @mailHeader={{this.mailHeader}} @handler="mailtourihandler=" />
|
|
`);
|
|
|
|
assert
|
|
.dom('a')
|
|
.hasAttribute(
|
|
'href',
|
|
'mailtourihandler=mailto:email%40example.com?subject=An+email+subject&cc=A+carbon+copy&bcc=A+blind+carbon+copy'
|
|
);
|
|
});
|
|
});
|