Add back acceptance tests for full page search
This commit is contained in:
parent
282f9948cb
commit
d8808aa9ab
|
@ -41,6 +41,7 @@ export function translateResults(results, opts) {
|
||||||
results.resultTypes = [];
|
results.resultTypes = [];
|
||||||
|
|
||||||
// TODO: consider refactoring front end to take a better structure
|
// TODO: consider refactoring front end to take a better structure
|
||||||
|
if (r) {
|
||||||
[['topic','posts'],['user','users'],['category','categories']].forEach(function(pair){
|
[['topic','posts'],['user','users'],['category','categories']].forEach(function(pair){
|
||||||
const type = pair[0], name = pair[1];
|
const type = pair[0], name = pair[1];
|
||||||
if (results[name].length > 0) {
|
if (results[name].length > 0) {
|
||||||
|
@ -59,6 +60,7 @@ export function translateResults(results, opts) {
|
||||||
results.resultTypes.push(result);
|
results.resultTypes.push(result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const noResults = !!(results.topics.length === 0 &&
|
const noResults = !!(results.topics.length === 0 &&
|
||||||
results.posts.length === 0 &&
|
results.posts.length === 0 &&
|
||||||
|
|
|
@ -1,12 +1,21 @@
|
||||||
import { acceptance } from "helpers/qunit-helpers";
|
import { acceptance } from "helpers/qunit-helpers";
|
||||||
acceptance("Search - Full Page");
|
acceptance("Search - Full Page");
|
||||||
|
|
||||||
// TODO: needs fixing (cc @sam)
|
test("perform various searches", assert => {
|
||||||
// test("search", (assert) => {
|
visit("/search");
|
||||||
// visit("/search?q=trout");
|
|
||||||
|
|
||||||
// andThen(() => {
|
andThen(() => {
|
||||||
// assert.ok(find('input.search').length > 0);
|
assert.ok(find('input.search').length > 0);
|
||||||
// assert.ok(find('.topic-list-item').length > 0);
|
assert.ok(find('.topic').length === 0);
|
||||||
// });
|
});
|
||||||
// });
|
|
||||||
|
fillIn('.search input', 'none');
|
||||||
|
click('.search .btn-primary');
|
||||||
|
|
||||||
|
andThen(() => assert.ok(find('.topic').length === 0), 'has no results');
|
||||||
|
|
||||||
|
fillIn('.search input', 'posts');
|
||||||
|
click('.search .btn-primary');
|
||||||
|
|
||||||
|
andThen(() => assert.ok(find('.topic').length === 1, 'has one post'));
|
||||||
|
});
|
||||||
|
|
|
@ -78,6 +78,19 @@ export default function() {
|
||||||
|
|
||||||
this.get('/clicks/track', success);
|
this.get('/clicks/track', success);
|
||||||
|
|
||||||
|
this.get('/search', request => {
|
||||||
|
if (request.queryParams.q === 'posts') {
|
||||||
|
return response({
|
||||||
|
posts: [{
|
||||||
|
id: 1234
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return response({});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
this.put('/users/eviltrout', () => response({ user: {} }));
|
this.put('/users/eviltrout', () => response({ user: {} }));
|
||||||
|
|
||||||
this.get("/t/280.json", () => response(fixturesByUrl['/t/280/1.json']));
|
this.get("/t/280.json", () => response(fixturesByUrl['/t/280/1.json']));
|
||||||
|
|
Loading…
Reference in New Issue