Merge branch 'develop' into refactor-component-structure
This commit is contained in:
5 files changed
+290
-53
No files matched your search
@@ -5,7 +5,7 @@
|
||||
|
||||
<layout.header>
|
||||
<Rose::Header as |header|>
|
||||
<header.brand @logo="logo-hashi" @text={{app-name}} />
|
||||
<header.brand @logo="logo-boundary" @text={{app-name}} />
|
||||
|
||||
{{#if this.session.isAuthenticated}}
|
||||
<header.utilities as |utilities|>
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<svg
|
||||
height="30"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 310 67">
|
||||
|
||||
<g id="LOGOS">
|
||||
<path
|
||||
fill="#ffffff"
|
||||
d="M104.58,32.17c3.08-1.33,4.48-3.21,4.48-6.54V21.45c0-5.44-3.09-8.59-10.72-8.59H82.5v40.3H99.44c7.32,0,11-3.57,11-9.26V39.61C110.45,35.67,108.27,33,104.58,32.17Zm-14.46-13h7.32c2.78,0,4,1,4,3.27V26c0,2.36-1.08,3.76-4.05,3.76H90.12Zm12.71,23.78c0,3-1.46,3.94-4.91,3.94h-7.8v-11h8.47c3,0,4.24,1.33,4.24,4Z">
|
||||
</path>
|
||||
|
||||
<path
|
||||
fill="#ffffff"
|
||||
d="M126.48,23.09c-10.1,0-12.82,5.56-12.82,11.62v7.44c0,6.05,2.72,11.61,12.82,11.61s12.83-5.56,12.83-11.61V34.71C139.31,28.65,136.58,23.09,126.48,23.09Zm5.45,19.3c0,3.33-1.51,5.08-5.45,5.08S121,45.72,121,42.39V34.47c0-3.34,1.51-5.09,5.44-5.09s5.45,1.75,5.45,5.09Z">
|
||||
</path>
|
||||
|
||||
<path
|
||||
fill="#ffffff"
|
||||
d="M161.46,23.69V44.15c-2.67,1.39-5.88,2.48-7.69,2.48s-2.36-.79-2.36-2.37V23.69H144V45.05c0,5.27,1.75,8.71,6.65,8.71a29.59,29.59,0,0,0,11.8-3.08l.73,2.48h5.63V23.69Z">
|
||||
</path>
|
||||
|
||||
<path
|
||||
fill="#ffffff"
|
||||
d="M193.34,23.09a29.59,29.59,0,0,0-11.8,3.08l-.72-2.48h-5.63V53.16h7.38V32.71c2.66-1.39,5.87-2.48,7.68-2.48s2.36.79,2.36,2.36V53.16H200V31.8C200,26.54,198.24,23.09,193.34,23.09Z">
|
||||
</path>
|
||||
|
||||
<path
|
||||
fill="#ffffff"
|
||||
d="M222.44,11.66V23.94a41,41,0,0,0-7.87-.85c-6.83,0-9.73,3.87-9.73,10.41v10c0,6.72,3.14,10.22,9.07,10.22a15.48,15.48,0,0,0,9.32-3.08l.72,2.48h5.87V10.63Zm0,33.15a10.43,10.43,0,0,1-6.59,2.66c-2.73,0-3.63-1.33-3.63-3.75V33.32c0-2.67,1-3.94,3.69-3.94a33,33,0,0,1,6.53.79Z">
|
||||
</path>
|
||||
|
||||
<path
|
||||
fill="#ffffff"
|
||||
d="M245.74,23.09a38.76,38.76,0,0,0-10.11,1.39l.91,5.63a40.74,40.74,0,0,1,8.17-.91c4.71,0,5.62,1.15,5.62,4.42V36.7h-7.07c-6,0-8.6,2.3-8.6,8.29,0,5.09,2.3,8.77,7.69,8.77a16.06,16.06,0,0,0,8.77-2.6l.54,2h6.06V33.74C257.72,26.35,255,23.09,245.74,23.09Zm4.59,23.29a11.57,11.57,0,0,1-5.56,1.51c-2.3,0-3-.9-3-3,0-2.24.67-2.9,3.09-2.9h5.44Z">
|
||||
</path>
|
||||
|
||||
<path
|
||||
fill="#ffffff"
|
||||
d="M277.92,23.09A33,33,0,0,0,270.18,27l-.48-3.27h-6.24V53.16h7.39v-19a56,56,0,0,1,7.8-4.29Z">
|
||||
</path>
|
||||
|
||||
<path
|
||||
fill="#ffffff"
|
||||
d="M300.61,23.69l-6.77,22.39-6.72-22.39h-7.56l9.32,29.47h2.59l-3.68,11.92h7l3.93-11.92,9.44-29.47Z">
|
||||
</path>
|
||||
|
||||
<polygon
|
||||
fill="#f04e54"
|
||||
points="9.89 64.1 9.89 59.28 19.9 59.28 19.9 56.3 15.05 56.3 15.05 51.45 37.97 51.45 27.32 33.01 37.97 14.57 14.47 14.57 14.47 40.15 1.82 40.15 1.82 1.92 45.34 1.92 52.61 14.5 41.92 33.01 52.83 51.9 45.78 64.1 9.89 64.1">
|
||||
</polygon>
|
||||
|
||||
<rect
|
||||
fill="#f04e54"
|
||||
x="6.98"
|
||||
y="51.45"
|
||||
width="4.85"
|
||||
height="4.85">
|
||||
</rect>
|
||||
|
||||
<rect
|
||||
fill="#f04e54"
|
||||
x="1.82"
|
||||
y="59.25"
|
||||
width="4.85"
|
||||
height="4.85">
|
||||
</rect>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
@@ -6,9 +6,9 @@ import a11yAudit from 'ember-a11y-testing/test-support/audit';
|
||||
import { Response } from 'miragejs';
|
||||
import {
|
||||
authenticateSession,
|
||||
// // These are left here intentionally for future reference.
|
||||
// //currentSession,
|
||||
// //invalidateSession,
|
||||
// These are left here intentionally for future reference.
|
||||
//currentSession,
|
||||
//invalidateSession,
|
||||
} from 'ember-simple-auth/test-support';
|
||||
|
||||
module('Acceptance | accounts', function (hooks) {
|
||||
@@ -29,7 +29,6 @@ module('Acceptance | accounts', function (hooks) {
|
||||
accounts: null,
|
||||
newAccount: null,
|
||||
account: null,
|
||||
setAccountPassword: null,
|
||||
};
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
@@ -46,7 +45,6 @@ module('Acceptance | accounts', function (hooks) {
|
||||
scope: instances.scopes.org,
|
||||
authMethod: instances.authMethod,
|
||||
});
|
||||
|
||||
// Generate route URLs for resources
|
||||
urls.orgScope = `/scopes/${instances.scopes.org.id}`;
|
||||
urls.authMethods = `${urls.orgScope}/auth-methods`;
|
||||
@@ -54,7 +52,6 @@ module('Acceptance | accounts', function (hooks) {
|
||||
urls.accounts = `${urls.authMethod}/accounts`;
|
||||
urls.newAccount = `${urls.accounts}/new`;
|
||||
urls.account = `${urls.accounts}/${instances.account.id}`;
|
||||
urls.setAccountPassword = `${urls.accounts}/${instances.account.id}/set-password`;
|
||||
});
|
||||
|
||||
hooks.afterEach(async function() {
|
||||
@@ -245,50 +242,4 @@ module('Acceptance | accounts', function (hooks) {
|
||||
'Displays field-level errors.'
|
||||
);
|
||||
});
|
||||
|
||||
module('password', function() {
|
||||
test('can set a new password for account', async function (assert) {
|
||||
assert.expect(1);
|
||||
this.server.post('/accounts/:id', (_, { requestBody }) => {
|
||||
const attrs = JSON.parse(requestBody);
|
||||
assert.equal(attrs.password, 'update password', 'new password is set');
|
||||
});
|
||||
await visit(urls.setAccountPassword);
|
||||
await fillIn('[name="password"]', 'update password');
|
||||
await click('form [type="submit"]:not(:disabled)');
|
||||
await a11yAudit();
|
||||
});
|
||||
|
||||
test('can cancel setting new password', async function (assert) {
|
||||
assert.expect(1);
|
||||
await visit(urls.setAccountPassword);
|
||||
await fillIn('[name="password"]', 'update password');
|
||||
await click('form button:not([type="submit"])');
|
||||
assert.notOk(find('[name="password"]').textContent.trim());
|
||||
});
|
||||
|
||||
test('errors are displayed when setting password fails', async function (assert) {
|
||||
assert.expect(1);
|
||||
this.server.post('/accounts/:id', () => {
|
||||
return new Response(
|
||||
490,
|
||||
{},
|
||||
{
|
||||
status: 490,
|
||||
code: 'error',
|
||||
message: 'Oops.',
|
||||
}
|
||||
);
|
||||
});
|
||||
await visit(urls.setAccountPassword);
|
||||
await fillIn('[name="password"]', 'update password');
|
||||
await click('form [type="submit"]');
|
||||
await a11yAudit();
|
||||
assert.ok(
|
||||
find('[role="alert"]').textContent.trim(),
|
||||
'Oops.',
|
||||
'Displays primary error message.'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,117 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click, find, fillIn } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import a11yAudit from 'ember-a11y-testing/test-support/audit';
|
||||
import { Response } from 'miragejs';
|
||||
import {
|
||||
authenticateSession,
|
||||
// These are left here intentionally for future reference.
|
||||
// currentSession,
|
||||
invalidateSession,
|
||||
} from 'ember-simple-auth/test-support';
|
||||
|
||||
module('Acceptance | accounts | change password', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
global: null,
|
||||
org: null,
|
||||
},
|
||||
account: null,
|
||||
};
|
||||
const urls = {
|
||||
orgScope: null,
|
||||
changePassword: null,
|
||||
};
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||
instances.scopes.org = this.server.create('scope', {
|
||||
type: 'org',
|
||||
scope: { id: 'global', type: 'global' },
|
||||
});
|
||||
instances.authMethod = this.server.create('auth-method', {
|
||||
scope: instances.scopes.org,
|
||||
});
|
||||
instances.account = this.server.create('account', {
|
||||
scope: instances.scopes.org
|
||||
});
|
||||
authenticateSession({
|
||||
account_id: instances.account.id
|
||||
});
|
||||
// Generate route URLs for resources
|
||||
urls.orgScope = `/scopes/${instances.scopes.org.id}`;
|
||||
urls.changePassword = `/account/change-password`;
|
||||
});
|
||||
|
||||
test('visiting account change password', async function (assert) {
|
||||
assert.expect(1);
|
||||
await visit(urls.changePassword);
|
||||
await a11yAudit();
|
||||
assert.equal(currentURL(), urls.changePassword);
|
||||
});
|
||||
|
||||
test('visiting account change password from header', async function (assert) {
|
||||
assert.expect(1);
|
||||
await visit(urls.orgScope);
|
||||
// Open header utilities dropdown
|
||||
await click('.rose-header-utilities .rose-dropdown summary');
|
||||
// Find first element in dropdown - should be change password link
|
||||
await click('.rose-header-utilities .rose-dropdown .rose-dropdown-content a');
|
||||
assert.equal(currentURL(), urls.changePassword);
|
||||
});
|
||||
|
||||
test('can change password for account', async function (assert) {
|
||||
assert.expect(2);
|
||||
this.server.post('/accounts/:id', (_, { requestBody }) => {
|
||||
const attrs = JSON.parse(requestBody);
|
||||
assert.equal(attrs.current_password, 'current password', 'current password is provided');
|
||||
assert.equal(attrs.new_password, 'new password', 'new password is provided');
|
||||
});
|
||||
await visit(urls.changePassword);
|
||||
await fillIn('[name="currentPassword"]', 'current password');
|
||||
await fillIn('[name="newPassword"]', 'new password');
|
||||
await click('form [type="submit"]:not(:disabled)');
|
||||
await a11yAudit();
|
||||
});
|
||||
|
||||
test('can cancel password change', async function (assert) {
|
||||
assert.expect(1);
|
||||
await visit(urls.changePassword);
|
||||
await fillIn('[name="currentPassword"]', 'current password');
|
||||
await fillIn('[name="newPassword"]', 'new password');
|
||||
await click('form button:not([type="submit"])');
|
||||
assert.notEqual(currentURL(), urls.changePassword);
|
||||
});
|
||||
|
||||
test('errors are displayed when changing password fails', async function (assert) {
|
||||
assert.expect(1);
|
||||
this.server.post('/accounts/:id', () => {
|
||||
return new Response(
|
||||
490,
|
||||
{},
|
||||
{
|
||||
status: 490,
|
||||
code: 'error',
|
||||
message: 'Oops.',
|
||||
}
|
||||
);
|
||||
});
|
||||
await visit(urls.changePassword);
|
||||
await fillIn('[name="currentPassword"]', 'current password');
|
||||
await fillIn('[name="newPassword"]', 'new password');
|
||||
await click('form [type="submit"]');
|
||||
await a11yAudit();
|
||||
assert.ok(find('[role="alert"]'));
|
||||
});
|
||||
|
||||
test('cannot change password when not authenticated', async function(assert) {
|
||||
assert.expect(1);
|
||||
invalidateSession();
|
||||
await visit(urls.changePassword);
|
||||
assert.notEqual(currentURL(), urls.changePassword);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,101 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click, find, fillIn } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import a11yAudit from 'ember-a11y-testing/test-support/audit';
|
||||
import { Response } from 'miragejs';
|
||||
import {
|
||||
authenticateSession,
|
||||
// These are left here intentionally for future reference.
|
||||
//currentSession,
|
||||
//invalidateSession,
|
||||
} from 'ember-simple-auth/test-support';
|
||||
|
||||
module('Acceptance | accounts | set password', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
global: null,
|
||||
org: null,
|
||||
},
|
||||
authMethods: null,
|
||||
account: null,
|
||||
};
|
||||
const urls = {
|
||||
orgScope: null,
|
||||
authMethods: null,
|
||||
accounts: null,
|
||||
setPassword: null,
|
||||
};
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
authenticateSession({});
|
||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||
instances.scopes.org = this.server.create('scope', {
|
||||
type: 'org',
|
||||
scope: { id: 'global', type: 'global' },
|
||||
});
|
||||
instances.authMethod = this.server.create('auth-method', {
|
||||
scope: instances.scopes.org,
|
||||
});
|
||||
instances.account = this.server.create('account', {
|
||||
scope: instances.scopes.org,
|
||||
authMethod: instances.authMethod,
|
||||
});
|
||||
// Generate route URLs for resources
|
||||
urls.orgScope = `/scopes/${instances.scopes.org.id}`;
|
||||
urls.authMethods = `${urls.orgScope}/auth-methods`;
|
||||
urls.authMethod = `${urls.authMethods}/${instances.authMethod.id}`;
|
||||
urls.accounts = `${urls.authMethod}/accounts`;
|
||||
urls.setPassword = `${urls.accounts}/${instances.account.id}/set-password`;
|
||||
});
|
||||
|
||||
test('visiting account set password', async function (assert) {
|
||||
assert.expect(1);
|
||||
await visit(urls.setPassword);
|
||||
await a11yAudit();
|
||||
assert.equal(currentURL(), urls.setPassword);
|
||||
});
|
||||
|
||||
test('can set a new password for account', async function (assert) {
|
||||
assert.expect(1);
|
||||
this.server.post('/accounts/:id', (_, { requestBody }) => {
|
||||
const attrs = JSON.parse(requestBody);
|
||||
assert.equal(attrs.password, 'update password', 'new password is set');
|
||||
});
|
||||
await visit(urls.setPassword);
|
||||
await fillIn('[name="password"]', 'update password');
|
||||
await click('form [type="submit"]:not(:disabled)');
|
||||
await a11yAudit();
|
||||
});
|
||||
|
||||
test('can cancel setting new password', async function (assert) {
|
||||
assert.expect(1);
|
||||
await visit(urls.setPassword);
|
||||
await fillIn('[name="password"]', 'update password');
|
||||
await click('form button:not([type="submit"])');
|
||||
assert.notOk(find('[name="password"]').textContent.trim());
|
||||
});
|
||||
|
||||
test('errors are displayed when setting password fails', async function (assert) {
|
||||
assert.expect(1);
|
||||
this.server.post('/accounts/:id', () => {
|
||||
return new Response(
|
||||
490,
|
||||
{},
|
||||
{
|
||||
status: 490,
|
||||
code: 'error',
|
||||
message: 'Oops.',
|
||||
}
|
||||
);
|
||||
});
|
||||
await visit(urls.setPassword);
|
||||
await fillIn('[name="password"]', 'update password');
|
||||
await click('form [type="submit"]');
|
||||
await a11yAudit();
|
||||
assert.ok(find('[role="alert"]'));
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user