refactor: Rename ui/core to ui/admin

This commit is contained in:
Susmitha Girumala committed 2020-11-16 16:18:31 -05:00
1 parent 3c71e7e7ce
commit 83dadb01b5
529 files changed

No files matched your search

@@ -0,0 +1,17 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | copyable', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
await render(
hbs`<Copyable @buttonText="Copy me" @text="foo">text</Copyable>`
);
assert.ok(find('.copyable'));
assert.equal(find('.copyable-content').textContent.trim(), 'text');
assert.equal(find('.copyable-button').textContent.trim(), 'Copy me');
});
});
@@ -0,0 +1,14 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | doc-link', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
assert.expect(1);
await render(hbs`<DocLink @doc="account" @iconSize="large" />`);
assert.ok(find('.doc-link .rose-icon.large'));
});
});
@@ -0,0 +1,66 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | error/message', function (hooks) {
setupRenderingTest(hooks);
test('it renders predefined message for known error status', async function (assert) {
await render(hbs`<Error::Message @status='401' />`);
assert.equal(
find('.rose-message-title').textContent.trim(),
'You are not signed in'
);
assert.equal(
find('.rose-message-subtitle').textContent.trim(),
'Error 401'
);
assert.equal(
find('.rose-message-description').textContent.trim(),
'You are not authenticated. Please authenticate and try again later.'
);
await render(hbs`<Error::Message @status='403' />`);
assert.equal(
find('.rose-message-title').textContent.trim(),
'You are not authorized'
);
assert.equal(
find('.rose-message-subtitle').textContent.trim(),
'Error 403'
);
assert.equal(
find('.rose-message-description').textContent.trim(),
'You must be granted permissions to view this data. Ask your administrator if you think you should have access.'
);
await render(hbs`<Error::Message @status='404' />`);
assert.equal(
find('.rose-message-title').textContent.trim(),
'Resource not found'
);
assert.equal(
find('.rose-message-subtitle').textContent.trim(),
'Error 404'
);
assert.equal(
find('.rose-message-description').textContent.trim(),
'We could not find the requested resource. You can ask your administrator or try again later.'
);
});
test('it renders default error for unknown error status', async function (assert) {
await render(hbs`<Error::Message @status='599' />`);
assert.equal(
find('.rose-message-title').textContent.trim(),
'Something went wrong'
);
assert.equal(
find('.rose-message-subtitle').textContent.trim(),
'Error 599'
);
assert.equal(
find('.rose-message-description').textContent.trim(),
'Please contact your administrator or try again later.'
);
});
});
@@ -0,0 +1,59 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, findAll, click } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | pending-confirmations', function (hooks) {
setupRenderingTest(hooks);
test('it renders pending confirmations', async function (assert) {
assert.expect(2);
const service = this.owner.lookup('service:confirm');
service.enabled = true;
await render(hbs`
<PendingConfirmations as |confirmations|>
<div class="pending">Pending</div>
</PendingConfirmations>
`);
assert.equal(findAll('.pending').length, 0, 'No pending confirmations');
service.confirm();
await render(hbs`
<PendingConfirmations as |confirmations|>
<div class="pending">Pending</div>
</PendingConfirmations>
`);
assert.equal(findAll('.pending').length, 1, 'One pending confirmations');
});
test('it exposes a confirm action that confirms the confirmation', async function (assert) {
assert.expect(3);
const service = this.owner.lookup('service:confirm');
service.enabled = true;
const confirmation = service.confirm();
confirmation.then(() => assert.ok(true, 'confirmation.then was called'));
await render(hbs`
<PendingConfirmations as |confirmations confirm|>
<button {{on "click" confirm}}>Confirm</button>
</PendingConfirmations>
`);
assert.notOk(confirmation.done, 'Confirmation is not done');
await click('button');
assert.ok(confirmation.done, 'Confirmation is done');
});
test('it exposes a dismiss action that dismisses the confirmation', async function (assert) {
assert.expect(3);
const service = this.owner.lookup('service:confirm');
service.enabled = true;
const confirmation = service.confirm();
confirmation.catch(() => assert.ok(true, 'confirmation.catch was called'));
await render(hbs`
<PendingConfirmations as |confirmations confirm dismiss|>
<button {{on "click" dismiss}}>Dismiss</button>
</PendingConfirmations>
`);
assert.notOk(confirmation.done, 'Confirmation is not done');
await click('button');
assert.ok(confirmation.done, 'Confirmation is done');
});
});