🧹 on policy upload file view (#29669)

* add margin and conditional

* add test coverage
This commit is contained in:
Angel Garbarino
2025-02-18 16:35:55 -07:00
committed by GitHub
parent f73c3feeac
commit 09e7c2e8fa
2 changed files with 23 additions and 4 deletions

View File

@@ -16,6 +16,7 @@ const SELECTORS = {
uploadFileToggle: '[data-test-policy-edit-toggle]',
policyEditor: '[data-test-policy-editor]',
policyUpload: '[data-test-text-file-input]',
altTabMessage: '[data-test-alt-tab-message]',
saveButton: '[data-test-policy-save]',
cancelButton: '[data-test-policy-cancel]',
error: '[data-test-message-error]',
@@ -158,6 +159,22 @@ module('Integration | Component | policy-form', function (hooks) {
assert.propEqual(this.onSave.lastCall.args[0].policy, policy, 'policy content saves in correct format');
});
test('it shows alt + tab message only when json editor is visible', async function (assert) {
await render(hbs`
<PolicyForm
@model={{this.model}}
@onCancel={{this.onCancel}}
@onSave={{this.onSave}}
/>
`);
assert.dom(SELECTORS.altTabMessage).exists({ count: 1 }, 'Alt tab message shows');
assert.dom(SELECTORS.policyEditor).exists({ count: 1 }, 'Policy editor is shown');
await click(SELECTORS.uploadFileToggle);
assert.dom(SELECTORS.policyUpload).exists({ count: 1 }, 'Policy upload is shown after toggle');
assert.dom(SELECTORS.altTabMessage).doesNotExist('Alt tab message is not shown');
});
test('it renders the form to edit existing ACL policy', async function (assert) {
const model = this.store.createRecord('policy/acl', {
name: 'bar',