Add breadcrumbs to users
This commit is contained in:
7 files changed
+112
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import Controller from '@ember/controller';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class OrgsOrgUsersController extends Controller {
|
||||
// =services
|
||||
|
||||
@service intl;
|
||||
|
||||
// =attributes
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
get breadCrumb() {
|
||||
return this.intl.t('resources.users');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import Controller from '@ember/controller';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class OrgsOrgUsersNewController extends Controller {
|
||||
// =services
|
||||
|
||||
@service intl;
|
||||
|
||||
// =attributes
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
get breadCrumb() {
|
||||
return this.intl.t('titles.new');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import Controller from '@ember/controller';
|
||||
import { alias } from '@ember/object/computed';
|
||||
|
||||
export default class OrgsOrgUsersUserController extends Controller {
|
||||
// =attributes
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
@alias('model.name') breadCrumb;
|
||||
}
|
||||
@@ -9,6 +9,7 @@ module('Acceptance | breadcrumbs', function (hooks) {
|
||||
|
||||
let org;
|
||||
let project;
|
||||
let user;
|
||||
let hostCatalog;
|
||||
let projectsURL;
|
||||
let newProjectURL;
|
||||
@@ -16,12 +17,17 @@ module('Acceptance | breadcrumbs', function (hooks) {
|
||||
let hostCatalogsURL;
|
||||
let newHostCatalogURL;
|
||||
let hostCatalogURL;
|
||||
let usersURL;
|
||||
let newUserURL;
|
||||
let userURL;
|
||||
|
||||
let crumbPath;
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
org = this.server.create('org');
|
||||
project = this.server.create('project');
|
||||
user = this.server.create('user');
|
||||
|
||||
hostCatalog = this.server.create('host-catalog');
|
||||
projectsURL = `/orgs/${org.id}/projects`;
|
||||
newProjectURL = `${projectsURL}/new`;
|
||||
@@ -29,6 +35,11 @@ module('Acceptance | breadcrumbs', function (hooks) {
|
||||
hostCatalogsURL = `${projectURL}/host-catalogs`;
|
||||
newHostCatalogURL = `${hostCatalogsURL}/new`;
|
||||
hostCatalogURL = `${hostCatalogsURL}/${hostCatalog.id}`;
|
||||
|
||||
// Users
|
||||
usersURL = `/orgs/${org.id}/users`;
|
||||
newUserURL = `${usersURL}/${user.id}`;
|
||||
userURL = `${usersURL}/new`;
|
||||
});
|
||||
|
||||
test('can navigate via breadcrumbs to projects from project', async function (assert) {
|
||||
@@ -81,4 +92,23 @@ module('Acceptance | breadcrumbs', function (hooks) {
|
||||
assert.equal(currentURL(), hostCatalogsURL, 'After navigating via breadcrumbs, we are one level up.');
|
||||
});
|
||||
|
||||
test('can navigate via breadcrumbs to users from user', async function (assert) {
|
||||
assert.expect(3);
|
||||
await visit(userURL);
|
||||
assert.equal(currentURL(), userURL, 'We begin on the expected page.');
|
||||
crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname;
|
||||
assert.equal(crumbPath, userURL, 'Last crumb has expected URL.');
|
||||
await click(find('.rose-nav-breadcrumbs-link:first-child'));
|
||||
assert.equal(currentURL(), usersURL, 'After navigating via breadcrumbs, we are one level up.');
|
||||
});
|
||||
|
||||
test('can navigate via breadcrumbs to users from new user', async function (assert) {
|
||||
assert.expect(3);
|
||||
await visit(newUserURL);
|
||||
assert.equal(currentURL(), newUserURL, 'We begin on th expected page.');
|
||||
crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname;
|
||||
assert.equal(crumbPath, newUserURL, 'Last crumb has expected URL.');
|
||||
await click(find('.rose-nav-breadcrumbs-link:first-child'));
|
||||
assert.equal(currentURL(), usersURL, 'After navigating via breadcrumbs, we are one level up.');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Controller | orgs/org/users', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let controller = this.owner.lookup('controller:orgs/org/users');
|
||||
assert.ok(controller);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Controller | orgs/org/users/new', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let controller = this.owner.lookup('controller:orgs/org/users/new');
|
||||
assert.ok(controller);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Controller | orgs/org/users/user', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let controller = this.owner.lookup('controller:orgs/org/users/user');
|
||||
assert.ok(controller);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user