mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	🧹 on policy upload file view (#29669)
* add margin and conditional * add test coverage
This commit is contained in:
		| @@ -69,7 +69,9 @@ | |||||||
|         </ToolbarActions> |         </ToolbarActions> | ||||||
|       </Toolbar> |       </Toolbar> | ||||||
|       {{#if this.showFileUpload}} |       {{#if this.showFileUpload}} | ||||||
|  |         <div class="has-top-margin-xs"> | ||||||
|           <TextFile @uploadOnly={{true}} @onChange={{this.setPolicyFromFile}} /> |           <TextFile @uploadOnly={{true}} @onChange={{this.setPolicyFromFile}} /> | ||||||
|  |         </div> | ||||||
|       {{else}} |       {{else}} | ||||||
|         <JsonEditor |         <JsonEditor | ||||||
|           @title="Policy" |           @title="Policy" | ||||||
| @@ -81,11 +83,11 @@ | |||||||
|           data-test-policy-editor |           data-test-policy-editor | ||||||
|         /> |         /> | ||||||
|       {{/if}} |       {{/if}} | ||||||
|       <div class="has-top-margin-xs"> |       {{#unless this.showFileUpload}} | ||||||
|         <span class="is-size-9 has-text-grey has-bottom-margin-l"> |         <span class="is-size-9 has-text-grey has-bottom-margin-l has-top-margin-xs" data-test-alt-tab-message> | ||||||
|           You can use Alt+Tab (Option+Tab on MacOS) in the code editor to skip to the next field. |           You can use Alt+Tab (Option+Tab on MacOS) in the code editor to skip to the next field. | ||||||
|         </span> |         </span> | ||||||
|       </div> |       {{/unless}} | ||||||
|     </div> |     </div> | ||||||
|     {{#each @model.additionalAttrs as |attr|}} |     {{#each @model.additionalAttrs as |attr|}} | ||||||
|       <FormField data-test-field={{true}} @attr={{attr}} @model={{@model}} /> |       <FormField data-test-field={{true}} @attr={{attr}} @model={{@model}} /> | ||||||
|   | |||||||
| @@ -16,6 +16,7 @@ const SELECTORS = { | |||||||
|   uploadFileToggle: '[data-test-policy-edit-toggle]', |   uploadFileToggle: '[data-test-policy-edit-toggle]', | ||||||
|   policyEditor: '[data-test-policy-editor]', |   policyEditor: '[data-test-policy-editor]', | ||||||
|   policyUpload: '[data-test-text-file-input]', |   policyUpload: '[data-test-text-file-input]', | ||||||
|  |   altTabMessage: '[data-test-alt-tab-message]', | ||||||
|   saveButton: '[data-test-policy-save]', |   saveButton: '[data-test-policy-save]', | ||||||
|   cancelButton: '[data-test-policy-cancel]', |   cancelButton: '[data-test-policy-cancel]', | ||||||
|   error: '[data-test-message-error]', |   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'); |     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) { |   test('it renders the form to edit existing ACL policy', async function (assert) { | ||||||
|     const model = this.store.createRecord('policy/acl', { |     const model = this.store.createRecord('policy/acl', { | ||||||
|       name: 'bar', |       name: 'bar', | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Angel Garbarino
					Angel Garbarino