From b9e934d668f4bc92c4093e97eb953f9b015f0165 Mon Sep 17 00:00:00 2001 From: Patrick Pircher Date: Sat, 27 Jul 2024 11:39:57 +0200 Subject: [PATCH 01/10] add boolean edit test --- tests/acceptance/object-inspector-test.js | 79 +++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/tests/acceptance/object-inspector-test.js b/tests/acceptance/object-inspector-test.js index 6ac43bbe41..89a170ce13 100644 --- a/tests/acceptance/object-inspector-test.js +++ b/tests/acceptance/object-inspector-test.js @@ -1006,6 +1006,85 @@ module('Object Inspector', function (hooks) { assert.dom('[data-test-object-property-value]').hasText(date.toString()); }); + test('Boolean fields are editable', async function (assert) { + assert.expect(5); + + await visit('/'); + + await sendMessage({ + type: 'objectInspector:updateObject', + name: 'My Object', + objectId: 'myObject', + details: [ + { + name: 'First Detail', + expand: false, + properties: [ + { + name: 'booleanProperty', + value: { + inspect: true.toString(), + type: 'type-boolean', + }, + }, + ], + }, + ], + }); + + respondWith( + 'objectInspector:saveProperty', + ({ objectId, property, value }) => { + assert.strictEqual(typeof value, 'boolean', 'sent as boolean'); + + return { + type: 'objectInspector:updateProperty', + objectId, + property, + mixinIndex: 0, + value: { + inspect: false.toString(), + type: 'type-boolean', + isCalculated: false, + }, + }; + } + ); + + await click('[data-test-object-detail-name]'); + + assert.dom('[data-test-object-property-value]').hasText(true.toString()); + + await click('[data-test-object-property-value]'); + + let field = find('.js-object-property-value-boolean'); + assert.ok(field); + + respondWith( + 'objectInspector:saveProperty', + ({ objectId, property, value }) => { + assert.strictEqual(typeof value, 'boolean', 'sent as boolean'); + + return { + type: 'objectInspector:updateProperty', + objectId, + property, + mixinIndex: 0, + value: { + inspect: false.toString(), + type: 'type-boolean', + isCalculated: false, + }, + }; + } + ); + + await fillIn(field, 'false'); + await triggerKeyEvent(field, 'keydown', 13); + + assert.dom('[data-test-object-property-value]').hasText(false.toString()); + }); + test('Errors are correctly displayed', async function (assert) { assert.expect(8); From a0e2fad13d586a0181956a81203a65e01af4cc9b Mon Sep 17 00:00:00 2001 From: Patrick Pircher Date: Sat, 27 Jul 2024 11:48:11 +0200 Subject: [PATCH 02/10] allow boolean edit --- app/components/object-inspector/property.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/components/object-inspector/property.ts b/app/components/object-inspector/property.ts index 82181b625c..880714acf5 100644 --- a/app/components/object-inspector/property.ts +++ b/app/components/object-inspector/property.ts @@ -122,7 +122,10 @@ export default class ObjectInspectorProperty extends Component Date: Sat, 27 Jul 2024 13:02:29 +0200 Subject: [PATCH 03/10] fix --- tests/acceptance/object-inspector-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/object-inspector-test.js b/tests/acceptance/object-inspector-test.js index 89a170ce13..eb3a1df84d 100644 --- a/tests/acceptance/object-inspector-test.js +++ b/tests/acceptance/object-inspector-test.js @@ -1057,7 +1057,7 @@ module('Object Inspector', function (hooks) { await click('[data-test-object-property-value]'); - let field = find('.js-object-property-value-boolean'); + let field = find('[data-test-object-property-value-txt]'); assert.ok(field); respondWith( From cd0b364edd7133fd278d69927d5e61e55a5e7ddb Mon Sep 17 00:00:00 2001 From: patrick Date: Mon, 29 Jul 2024 16:46:01 +0200 Subject: [PATCH 04/10] fix --- tests/acceptance/object-inspector-test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/acceptance/object-inspector-test.js b/tests/acceptance/object-inspector-test.js index eb3a1df84d..d3c57b4670 100644 --- a/tests/acceptance/object-inspector-test.js +++ b/tests/acceptance/object-inspector-test.js @@ -1025,6 +1025,7 @@ module('Object Inspector', function (hooks) { value: { inspect: true.toString(), type: 'type-boolean', + isCalculated: true }, }, ], @@ -1082,6 +1083,7 @@ module('Object Inspector', function (hooks) { await fillIn(field, 'false'); await triggerKeyEvent(field, 'keydown', 13); + assert.dom('[data-test-object-property-value]').hasText(false.toString()); }); From f9092631b4c680e01e8f2e5aafb9d68d54ad85c2 Mon Sep 17 00:00:00 2001 From: Patrick Pircher Date: Mon, 29 Jul 2024 19:19:00 +0200 Subject: [PATCH 05/10] fix --- tests/acceptance/object-inspector-test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/acceptance/object-inspector-test.js b/tests/acceptance/object-inspector-test.js index d3c57b4670..9f31b4f8fd 100644 --- a/tests/acceptance/object-inspector-test.js +++ b/tests/acceptance/object-inspector-test.js @@ -1046,7 +1046,7 @@ module('Object Inspector', function (hooks) { value: { inspect: false.toString(), type: 'type-boolean', - isCalculated: false, + isCalculated: false }, }; } @@ -1083,7 +1083,6 @@ module('Object Inspector', function (hooks) { await fillIn(field, 'false'); await triggerKeyEvent(field, 'keydown', 13); - assert.dom('[data-test-object-property-value]').hasText(false.toString()); }); From 26507f67988927aa54038dab572132d3f2559e6c Mon Sep 17 00:00:00 2001 From: Patrick Pircher Date: Mon, 29 Jul 2024 19:21:28 +0200 Subject: [PATCH 06/10] fix --- tests/acceptance/object-inspector-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/object-inspector-test.js b/tests/acceptance/object-inspector-test.js index 9f31b4f8fd..97c92c820c 100644 --- a/tests/acceptance/object-inspector-test.js +++ b/tests/acceptance/object-inspector-test.js @@ -1025,7 +1025,7 @@ module('Object Inspector', function (hooks) { value: { inspect: true.toString(), type: 'type-boolean', - isCalculated: true + isCalculated: true, }, }, ], @@ -1046,7 +1046,7 @@ module('Object Inspector', function (hooks) { value: { inspect: false.toString(), type: 'type-boolean', - isCalculated: false + isCalculated: false, }, }; } From f28ba4f58a0d30306b4d17a9b1378aca33353bd1 Mon Sep 17 00:00:00 2001 From: Patrick Pircher Date: Mon, 29 Jul 2024 20:20:05 +0200 Subject: [PATCH 07/10] fix --- tests/acceptance/object-inspector-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/object-inspector-test.js b/tests/acceptance/object-inspector-test.js index 97c92c820c..42669561a2 100644 --- a/tests/acceptance/object-inspector-test.js +++ b/tests/acceptance/object-inspector-test.js @@ -1081,7 +1081,7 @@ module('Object Inspector', function (hooks) { ); await fillIn(field, 'false'); - await triggerKeyEvent(field, 'keydown', 13); + await triggerKeyEvent(field, 'keyup', 13); assert.dom('[data-test-object-property-value]').hasText(false.toString()); }); From af25ae8ccb4aadb62135fc8035437063f25a85e6 Mon Sep 17 00:00:00 2001 From: Patrick Pircher Date: Mon, 29 Jul 2024 20:23:38 +0200 Subject: [PATCH 08/10] only one save --- tests/acceptance/object-inspector-test.js | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/tests/acceptance/object-inspector-test.js b/tests/acceptance/object-inspector-test.js index 42669561a2..9c1010f442 100644 --- a/tests/acceptance/object-inspector-test.js +++ b/tests/acceptance/object-inspector-test.js @@ -1061,25 +1061,6 @@ module('Object Inspector', function (hooks) { let field = find('[data-test-object-property-value-txt]'); assert.ok(field); - respondWith( - 'objectInspector:saveProperty', - ({ objectId, property, value }) => { - assert.strictEqual(typeof value, 'boolean', 'sent as boolean'); - - return { - type: 'objectInspector:updateProperty', - objectId, - property, - mixinIndex: 0, - value: { - inspect: false.toString(), - type: 'type-boolean', - isCalculated: false, - }, - }; - } - ); - await fillIn(field, 'false'); await triggerKeyEvent(field, 'keyup', 13); From afcdc50e0a80247c958e9bd9a5abb2039e3179ae Mon Sep 17 00:00:00 2001 From: Patrick Pircher Date: Mon, 29 Jul 2024 20:29:16 +0200 Subject: [PATCH 09/10] fix assertion count --- tests/acceptance/object-inspector-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/object-inspector-test.js b/tests/acceptance/object-inspector-test.js index 9c1010f442..408422130b 100644 --- a/tests/acceptance/object-inspector-test.js +++ b/tests/acceptance/object-inspector-test.js @@ -1007,7 +1007,7 @@ module('Object Inspector', function (hooks) { }); test('Boolean fields are editable', async function (assert) { - assert.expect(5); + assert.expect(4); await visit('/'); From 075ae98aef76d015e8870059d4615d4d6f3db84d Mon Sep 17 00:00:00 2001 From: Patrick Pircher Date: Tue, 30 Jul 2024 06:45:20 +0200 Subject: [PATCH 10/10] simplify Co-authored-by: Robbie Wagner --- app/components/object-inspector/property.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/components/object-inspector/property.ts b/app/components/object-inspector/property.ts index 880714acf5..5009d7dd34 100644 --- a/app/components/object-inspector/property.ts +++ b/app/components/object-inspector/property.ts @@ -122,10 +122,7 @@ export default class ObjectInspectorProperty extends Component