refactor: 💡 application state ability dependent descriptions (#2631)
* refactor: 💡 application state ability dependent descriptions ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-15813
This commit is contained in:
1 parent
5be4868e9a
commit
7695135302
51 files changed
+1114
-311
No files matched your search
+35
@@ -18,6 +18,7 @@ module(
|
||||
setupMirage(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
let intl;
|
||||
let controller;
|
||||
let store;
|
||||
let getAccountCount;
|
||||
@@ -36,6 +37,7 @@ module(
|
||||
|
||||
hooks.beforeEach(async function () {
|
||||
await authenticateSession({});
|
||||
intl = this.owner.lookup('service:intl');
|
||||
controller = this.owner.lookup(
|
||||
'controller:scopes/scope/auth-methods/auth-method/accounts/index',
|
||||
);
|
||||
@@ -94,5 +96,38 @@ module(
|
||||
|
||||
assert.strictEqual(getAccountCount(), accountCount - 1);
|
||||
});
|
||||
|
||||
test('messageDescription returns correct translation with list authorization', async function (assert) {
|
||||
await visit(urls.accounts);
|
||||
|
||||
assert.strictEqual(
|
||||
controller.messageDescription,
|
||||
intl.t('resources.account.description'),
|
||||
);
|
||||
});
|
||||
|
||||
test('messageDescription returns correct translation with create authorization', async function (assert) {
|
||||
instances.authMethod.authorized_collection_actions.accounts = ['create'];
|
||||
await visit(urls.accounts);
|
||||
|
||||
assert.strictEqual(
|
||||
controller.messageDescription,
|
||||
intl.t('descriptions.create-but-not-list', {
|
||||
resource: intl.t('resources.account.title_plural'),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
test('messageDescription returns correct translation with no authorization', async function (assert) {
|
||||
instances.authMethod.authorized_collection_actions.accounts = [];
|
||||
await visit(urls.accounts);
|
||||
|
||||
assert.strictEqual(
|
||||
controller.messageDescription,
|
||||
intl.t('descriptions.neither-list-nor-create', {
|
||||
resource: intl.t('resources.account.title_plural'),
|
||||
}),
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
+37
@@ -18,6 +18,7 @@ module(
|
||||
setupMirage(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
let intl;
|
||||
let controller;
|
||||
let store;
|
||||
let getManagedGroupCount;
|
||||
@@ -36,6 +37,7 @@ module(
|
||||
|
||||
hooks.beforeEach(async function () {
|
||||
await authenticateSession({});
|
||||
intl = this.owner.lookup('service:intl');
|
||||
controller = this.owner.lookup(
|
||||
'controller:scopes/scope/auth-methods/auth-method/managed-groups/index',
|
||||
);
|
||||
@@ -117,5 +119,40 @@ module(
|
||||
|
||||
assert.true(managedGroup.hasDirtyAttributes);
|
||||
});
|
||||
|
||||
test('messageDescription returns correct translation with list authorization', async function (assert) {
|
||||
await visit(urls.managedGroups);
|
||||
|
||||
assert.strictEqual(
|
||||
controller.messageDescription,
|
||||
intl.t('resources.managed-group.description'),
|
||||
);
|
||||
});
|
||||
|
||||
test('messageDescription returns correct translation with create authorization', async function (assert) {
|
||||
instances.authMethod.authorized_collection_actions['managed-groups'] = [
|
||||
'create',
|
||||
];
|
||||
await visit(urls.managedGroups);
|
||||
|
||||
assert.strictEqual(
|
||||
controller.messageDescription,
|
||||
intl.t('descriptions.create-but-not-list', {
|
||||
resource: intl.t('resources.managed-group.title_plural'),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
test('messageDescription returns correct translation with no authorization', async function (assert) {
|
||||
instances.authMethod.authorized_collection_actions['managed-groups'] = [];
|
||||
await visit(urls.managedGroups);
|
||||
|
||||
assert.strictEqual(
|
||||
controller.messageDescription,
|
||||
intl.t('descriptions.neither-list-nor-create', {
|
||||
resource: intl.t('resources.managed-group.title_plural'),
|
||||
}),
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
Reference in new issue
Block a user