From 1e61182dd6e2af4755c83ad3244f2e07fca37f5a Mon Sep 17 00:00:00 2001 From: Cory Forsyth Date: Fri, 10 Jan 2025 13:32:40 +0100 Subject: [PATCH 1/2] Failing test --- .../components/json-viewer-test.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test-app/tests/integration/components/json-viewer-test.js b/test-app/tests/integration/components/json-viewer-test.js index 3bee2fe..4ac812d 100644 --- a/test-app/tests/integration/components/json-viewer-test.js +++ b/test-app/tests/integration/components/json-viewer-test.js @@ -145,4 +145,23 @@ module('Integration | Component | json-viewer', function (hooks) { assert.strictEqual(userSelectStyle, expected); } }); + + test('no comma after final object', async function (assert) { + this.set('json', { + obj: { foo: 'bar' }, + }); + await render( + hbs``, + ); + + assert + .dom('[data-path="$.obj>"]') + .containsText('}', 'object closing brace is present'); + assert + .dom('[data-path="$.obj@,"]') + .doesNotExist('no comma after final object'); + assert + .dom('[data-test-json-viewer-outer]') + .doesNotContainText(',', 'No comma appears in the output'); + }); }); From e1c54ee6f4700c36cdc20882389f226e8c41ee3f Mon Sep 17 00:00:00 2001 From: Cory Forsyth Date: Fri, 10 Jan 2025 13:33:34 +0100 Subject: [PATCH 2/2] Fix bug where an extra comma is added after final object --- addon/addon/components/entry-viewer.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon/addon/components/entry-viewer.hbs b/addon/addon/components/entry-viewer.hbs index 27d3181..8e24483 100644 --- a/addon/addon/components/entry-viewer.hbs +++ b/addon/addon/components/entry-viewer.hbs @@ -30,7 +30,7 @@ @displayOptions={{@displayOptions}} @path={{@path}} /> - {{#unless this.isLast}} + {{#unless @isLast}} {{! In order for copy/paste to work, there cannot be extra whitespace around the delimiter }} , {{/unless}}