diff --git a/ui/core/app/routes/scopes/scope/orgs.js b/ui/core/app/routes/scopes/scope/orgs.js index 1e07d5f65..30a6c938f 100644 --- a/ui/core/app/routes/scopes/scope/orgs.js +++ b/ui/core/app/routes/scopes/scope/orgs.js @@ -12,10 +12,13 @@ export default class ScopesScopeOrgsRoute extends Route { // =methods /** - * If arriving here unauthenticated, redirect to index for further processing. + * If arriving here unauthenticated or from a non-global scope, + * redirect to index for further processing. */ beforeModel() { if (!this.session.isAuthenticated) this.transitionTo('index'); + const scope = this.modelFor('scopes.scope'); + if(!scope.isGlobal) this.transitionTo('index'); } /** diff --git a/ui/core/tests/acceptance/orgs-test.js b/ui/core/tests/acceptance/orgs-test.js index 7e15bab90..aaeca8356 100644 --- a/ui/core/tests/acceptance/orgs-test.js +++ b/ui/core/tests/acceptance/orgs-test.js @@ -56,25 +56,26 @@ module('Acceptance | org', function (hooks) { assert.equal(findAll('article').length, orgsCount); }); - test('visiting scopes redirects to orgs', async function (assert) { + test('visiting scopes redirects to index', async function (assert) { assert.expect(1); await visit(urls.scopes); - await a11yAudit(); assert.equal(currentURL(), urls.orgs); }); - test('visiting root redirects to orgs', async function (assert) { + test('visiting root redirects to index', async function (assert) { assert.expect(1); await visit(urls.root); - await a11yAudit(); assert.equal(currentURL(), urls.orgs); }); - test('visiting orgs within a org scope redirects to the parent org scope', async function (assert) { - assert.expect(0); + test('visiting orgs within a non global scope redirects to index', async function (assert) { + const nonGlobalScopeURL = `${urls.scopes}/123/orgs`; + assert.expect(1); + await visit(nonGlobalScopeURL); + assert.equal(currentURL(), urls.orgs); }); - test('can create new orgs', async function (assert) { + test('can create a new org', async function (assert) { assert.expect(1); await visit(urls.newOrg); await fillIn('[name="name"]', 'Org name'); @@ -83,7 +84,7 @@ module('Acceptance | org', function (hooks) { assert.equal(this.server.db.scopes.where(scope => scope.type === 'org').length, orgsCount + 1); }); - test('can cancel create new orgs', async function (assert) { + test('can cancel new org creation', async function (assert) { assert.expect(2); await visit(urls.newOrg); await fillIn('[name="name"]', 'Org name');