mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 01:14:12 +08:00
TESTS: Integration tests for badge pages
This commit is contained in:
@ -8,8 +8,15 @@ var ApplicationRoute = Em.Route.extend({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var exceptionController = this.controllerFor('exception');
|
var exceptionController = this.controllerFor('exception'),
|
||||||
Em.warn(err);
|
errorString = err.toString();
|
||||||
|
if (err.statusText) {
|
||||||
|
errorString = err.statusText;
|
||||||
|
}
|
||||||
|
var c = window.console;
|
||||||
|
if (c && c.error) {
|
||||||
|
c.error(errorString);
|
||||||
|
}
|
||||||
exceptionController.setProperties({ lastTransition: transition, thrown: err });
|
exceptionController.setProperties({ lastTransition: transition, thrown: err });
|
||||||
|
|
||||||
this.intermediateTransitionTo('exception');
|
this.intermediateTransitionTo('exception');
|
||||||
|
4
test/javascripts/fixtures/badges_fixture.js
Normal file
4
test/javascripts/fixtures/badges_fixture.js
Normal file
File diff suppressed because one or more lines are too long
@ -1,5 +1,3 @@
|
|||||||
/* global console */
|
|
||||||
|
|
||||||
function parsePostData(query) {
|
function parsePostData(query) {
|
||||||
var result = {};
|
var result = {};
|
||||||
query.split("&").forEach(function(part) {
|
query.split("&").forEach(function(part) {
|
||||||
@ -60,7 +58,9 @@ export default function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
server.unhandledRequest = function(verb, path) {
|
server.unhandledRequest = function(verb, path) {
|
||||||
console.error('Unhandled request in test environment: ' + path + ' (' + verb + ')');
|
var error = 'Unhandled request in test environment: ' + path + ' (' + verb + ')';
|
||||||
|
window.console.error(error);
|
||||||
|
throw error;
|
||||||
};
|
};
|
||||||
|
|
||||||
return server;
|
return server;
|
||||||
|
14
test/javascripts/integration/badges-test.js.es6
Normal file
14
test/javascripts/integration/badges-test.js.es6
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
integration("Badges");
|
||||||
|
|
||||||
|
test("Visit Badge Pages", function() {
|
||||||
|
visit("/badges");
|
||||||
|
andThen(function() {
|
||||||
|
ok(exists('.badges-listing tr'), "has a list of badges");
|
||||||
|
});
|
||||||
|
|
||||||
|
visit("/badges/9/autobiographer");
|
||||||
|
andThen(function() {
|
||||||
|
ok(exists('.badges-listing tr'), "has the badge in the listing");
|
||||||
|
ok(exists('.badge-user'), "has the list of users with that badge");
|
||||||
|
});
|
||||||
|
});
|
@ -20,6 +20,6 @@ test("Visit Discovery Pages", function() {
|
|||||||
|
|
||||||
visit("/top");
|
visit("/top");
|
||||||
andThen(function() {
|
andThen(function() {
|
||||||
ok(exists('.topic-list .topic-list-item'), "has topics");
|
ok(exists('.topic-list tr td.main-link'), "has topics");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user