chore: 🤖 Add breadcrumbs to groups pages

Add missing role breadcrumb tests
This commit is contained in:
Susmitha Girumala committed 2020-06-24 17:42:09 -04:00
1 parent 56f618e8ae
commit 30f97e93fc
10 files changed
+158 -11

No files matched your search

@@ -0,0 +1,17 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class OrgsOrgGroupsController extends Controller {
// =services
@service intl;
// =attributes
/**
* @type {string}
*/
get breadCrumb() {
return this.intl.t('resources.groups');
}
}
@@ -0,0 +1,12 @@
import Controller from '@ember/controller';
import { alias } from '@ember/object/computed';
export default class OrgsOrgGroupsGroupController extends Controller {
// =attributes
/**
* @type {string}
*/
@alias('model.name') breadCrumb;
}
@@ -0,0 +1,18 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class OrgsOrgGroupsNewController extends Controller {
// =services
@service intl;
// =attributes
/**
* @type {string}
*/
get breadCrumb() {
return this.intl.t('titles.new');
}
}
@@ -1,5 +1,9 @@
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.header>
<h2>{{t "resources.group"}}</h2>
</page.header>
@@ -1,5 +1,9 @@
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.header>
<h2>{{t "resources.groups"}}</h2>
</page.header>
@@ -1,4 +1,9 @@
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.header>
<h2>{{t "titles.new"}}</h2>
</page.header>
+62 -11
View File
@@ -10,12 +10,12 @@ module('Acceptance | breadcrumbs', function (hooks) {
let org;
let project;
let hostCatalog;
let projectsURL;
let newProjectURL;
let projectURL;
let hostCatalogsURL;
let newHostCatalogURL;
let hostCatalogURL;
let role;
let group;
let projectsURL, projectURL, newProjectURL;
let hostCatalogsURL, hostCatalogURL, newHostCatalogURL;
let rolesURL, roleURL, newRoleURL;
let groupsURL, groupURL, newGroupURL;
let crumbPath;
@@ -23,18 +23,30 @@ module('Acceptance | breadcrumbs', function (hooks) {
org = this.server.create('org');
project = this.server.create('project');
hostCatalog = this.server.create('host-catalog');
role = this.server.create('role');
group = this.server.create('group');
projectsURL = `/orgs/${org.id}/projects`;
newProjectURL = `${projectsURL}/new`;
projectURL = `${projectsURL}/${project.id}`;
hostCatalogsURL = `${projectURL}/host-catalogs`;
newHostCatalogURL = `${hostCatalogsURL}/new`;
hostCatalogURL = `${hostCatalogsURL}/${hostCatalog.id}`;
rolesURL = `/orgs/${org.id}/roles`;
newRoleURL = `${rolesURL}/new`;
roleURL = `${rolesURL}/${role.id}`;
groupsURL = `/orgs/${org.id}/groups`;
newGroupURL = `${groupsURL}/new`;
groupURL = `${groupsURL}/${group.id}`;
});
test('can navigate via breadcrumbs to projects from project', async function (assert) {
assert.expect(3);
await visit(projectURL);
assert.equal(currentURL(), projectURL, 'We begin on th expected page.');
assert.equal(currentURL(), projectURL, 'We begin on the expected page.');
crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname;
assert.equal(crumbPath, projectURL, 'Last crumb has expected URL.');
await click(find('.rose-nav-breadcrumbs-link:first-child'));
@@ -44,7 +56,7 @@ module('Acceptance | breadcrumbs', function (hooks) {
test('can navigate via breadcrumbs to projects from new project', async function (assert) {
assert.expect(3);
await visit(newProjectURL);
assert.equal(currentURL(), newProjectURL, 'We begin on th expected page.');
assert.equal(currentURL(), newProjectURL, 'We begin on the expected page.');
crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname;
assert.equal(crumbPath, newProjectURL, 'Last crumb has expected URL.');
await click(find('.rose-nav-breadcrumbs-link:first-child'));
@@ -54,7 +66,7 @@ module('Acceptance | breadcrumbs', function (hooks) {
test('can navigate via breadcrumbs to project from host catalogs', async function (assert) {
assert.expect(3);
await visit(hostCatalogsURL);
assert.equal(currentURL(), hostCatalogsURL, 'We begin on th expected page.');
assert.equal(currentURL(), hostCatalogsURL, 'We begin on the expected page.');
crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname;
assert.equal(crumbPath, hostCatalogsURL, 'Last crumb has expected URL.');
await click(findAll('.rose-nav-breadcrumbs-link')[1]);
@@ -64,7 +76,7 @@ module('Acceptance | breadcrumbs', function (hooks) {
test('can navigate via breadcrumbs to host catalogs from host catalog', async function (assert) {
assert.expect(3);
await visit(hostCatalogURL);
assert.equal(currentURL(), hostCatalogURL, 'We begin on th expected page.');
assert.equal(currentURL(), hostCatalogURL, 'We begin on the expected page.');
crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname;
assert.equal(crumbPath, hostCatalogURL, 'Last crumb has expected URL.');
await click(findAll('.rose-nav-breadcrumbs-link')[2]);
@@ -74,11 +86,50 @@ module('Acceptance | breadcrumbs', function (hooks) {
test('can navigate via breadcrumbs to host catalogs from new host catalog', async function (assert) {
assert.expect(3);
await visit(newHostCatalogURL);
assert.equal(currentURL(), newHostCatalogURL, 'We begin on th expected page.');
assert.equal(currentURL(), newHostCatalogURL, 'We begin on the expected page.');
crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname;
assert.equal(crumbPath, newHostCatalogURL, 'Last crumb has expected URL.');
await click(findAll('.rose-nav-breadcrumbs-link')[2]);
assert.equal(currentURL(), hostCatalogsURL, 'After navigating via breadcrumbs, we are one level up.');
});
test('can navigate via breadcrumbs to roles from role', async function (assert) {
assert.expect(3);
await visit(roleURL);
assert.equal(currentURL(), roleURL, 'We begin on the expected page.');
crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname;
assert.equal(crumbPath, roleURL, 'Last crumb has expected URL.');
await click(find('.rose-nav-breadcrumbs-link:first-child'));
assert.equal(currentURL(), rolesURL, 'After navigating via breadcrumbs, we are one level up.');
});
test('can navigate via breadcrumbs to roles from new role', async function (assert) {
assert.expect(3);
await visit(newRoleURL);
assert.equal(currentURL(), newRoleURL, 'We begin on the expected page.');
crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname;
assert.equal(crumbPath, newRoleURL, 'Last crumb has expected URL.');
await click(find('.rose-nav-breadcrumbs-link:first-child'));
assert.equal(currentURL(), rolesURL, 'After navigating via breadcrumbs, we are one level up.');
});
test('can navigate via breadcrumbs to groups from group', async function (assert) {
assert.expect(3);
await visit(groupURL);
assert.equal(currentURL(), groupURL, 'We begin on the expected page.');
crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname;
assert.equal(crumbPath, groupURL, 'Last crumb has expected URL.');
await click(find('.rose-nav-breadcrumbs-link:first-child'));
assert.equal(currentURL(), groupsURL, 'After navigating via breadcrumbs, we are one level up.');
});
test('can navigate via breadcrumbs to groups from new group', async function (assert) {
assert.expect(3);
await visit(newGroupURL);
assert.equal(currentURL(), newGroupURL, 'We begin on the expected page.');
crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname;
assert.equal(crumbPath, newGroupURL, 'Last crumb has expected URL.');
await click(find('.rose-nav-breadcrumbs-link:first-child'));
assert.equal(currentURL(), groupsURL, '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/groups', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.owner.lookup('controller:orgs/org/groups');
assert.ok(controller);
});
});
@@ -0,0 +1,12 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | orgs/org/groups/group', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.owner.lookup('controller:orgs/org/groups/group');
assert.ok(controller);
});
});
@@ -0,0 +1,12 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | orgs/org/groups/new', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.owner.lookup('controller:orgs/org/groups/new');
assert.ok(controller);
});
});