From 479d51faf0c4a4c45fa27b097c06ce82911b699e Mon Sep 17 00:00:00 2001 From: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com> Date: Wed, 14 Dec 2022 12:09:25 -0600 Subject: [PATCH] Add followup test for displaying post in query results (#198) --- .../components/query-result-test.js | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/test/javascripts/integration/components/query-result-test.js b/test/javascripts/integration/components/query-result-test.js index a157670..8f4b7e5 100644 --- a/test/javascripts/integration/components/query-result-test.js +++ b/test/javascripts/integration/components/query-result-test.js @@ -100,6 +100,45 @@ discourseModule( ); }, }); + + componentTest("it renders a post in query results", { + template: hbs`{{query-result content=content}}`, + + beforeEach() { + const results = { + colrender: { 0: "post" }, + relations: { + post: [ + { + description: "description", + id: 1, + topic_id: 1, + post_number: 1, + excerpt: "foo", + username: "user1", + avatar_template: "", + }, + ], + }, + result_count: 1, + columns: [""], + rows: [[1]], + }; + this.set("content", results); + }, + + test(assert) { + assert.ok( + query("table tbody tr:nth-child(1) td:nth-child(1) aside").dataset + .post === "1" + ); + + assert.ok( + query("table tbody tr:nth-child(1) td:nth-child(1) aside").dataset + .topic === "1" + ); + }, + }); } );