From 3c18b74d77b38d6a42dbcc8121709a1c3990588d Mon Sep 17 00:00:00 2001 From: Matthew Irish Date: Thu, 12 Jul 2018 08:51:55 -0500 Subject: [PATCH 1/2] disable JSON toggle when data is not only strings --- ui/app/templates/components/secret-edit.hbs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ui/app/templates/components/secret-edit.hbs b/ui/app/templates/components/secret-edit.hbs index ac5bbbf0791f..218ba3b43474 100644 --- a/ui/app/templates/components/secret-edit.hbs +++ b/ui/app/templates/components/secret-edit.hbs @@ -27,7 +27,16 @@
- +
{{#if (and (not-eq mode 'create') (or capabilities.canUpdate capabilities.canDelete))}} From 5a66937e66998ad48c64a410e7c9c6212bc4d79b Mon Sep 17 00:00:00 2001 From: Matthew Irish Date: Thu, 12 Jul 2018 20:46:46 -0500 Subject: [PATCH 2/2] add tests --- .../components/secret-edit-test.js | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 ui/tests/integration/components/secret-edit-test.js diff --git a/ui/tests/integration/components/secret-edit-test.js b/ui/tests/integration/components/secret-edit-test.js new file mode 100644 index 000000000000..13d069d7a9b3 --- /dev/null +++ b/ui/tests/integration/components/secret-edit-test.js @@ -0,0 +1,34 @@ +import { moduleForComponent, test } from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; + +moduleForComponent('secret-edit', 'Integration | Component | secret edit', { + integration: true, +}); + +test('it disables JSON toggle in show mode when is an advanced format', function(assert) { + this.set('mode', 'show'); + this.set('key', { + secretData: { + int: 2, + null: null, + float: 1.234, + }, + }); + + this.render(hbs`{{secret-edit mode=mode key=key }}`); + assert.dom('[data-test-secret-json-toggle]').isDisabled(); +}); + +test('it does JSON toggle in show mode when is', function(assert) { + this.set('mode', 'show'); + this.set('key', { + secretData: { + int: '2', + null: 'null', + float: '1.234', + }, + }); + + this.render(hbs`{{secret-edit mode=mode key=key }}`); + assert.dom('[data-test-secret-json-toggle]').isNotDisabled(); +});