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:
Isaac Janzen
2022-12-20 16:55:11 -06:00
committed by GitHub
parent 4c70cfa100
commit 85c88c5d80
2 changed files with 19 additions and 1 deletions
@@ -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");
},
});
}
);