DEV: Better handling of no results (#205)
When there were no query results it would throw an error due to `this.resultCount` always passing as it is in the format of ``` "INTEGER - results returned" ``` so we need to grab the first index of the string and check if the integer is great than 0
This commit is contained in:
@@ -326,5 +326,23 @@ discourseModule(
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
componentTest("it handles no results", {
|
||||
template: hbs`<QueryResult @content={{content}} />`,
|
||||
|
||||
beforeEach() {
|
||||
const results = {
|
||||
colrender: [],
|
||||
result_count: 0,
|
||||
columns: ["user_name", "like_count", "post_count"],
|
||||
rows: [],
|
||||
};
|
||||
this.set("content", results);
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(!exists("table tbody tr"), "renders no results");
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user