mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Category List and Topic View Integration Test
This commit is contained in:
parent
3775a9c11d
commit
3257bef387
7 changed files with 43 additions and 4 deletions
|
@ -22,6 +22,9 @@ Discourse = Ember.Application.createWithMixins({
|
|||
// The highest seen post number by topic
|
||||
highestSeenByTopic: {},
|
||||
|
||||
// Helps with integration tests
|
||||
URL_FIXTURES: {},
|
||||
|
||||
getURL: function(url) {
|
||||
|
||||
// If it's a non relative URL, return it.
|
||||
|
|
|
@ -388,7 +388,10 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
|||
|
||||
nonUrgentPositionUpdate: Discourse.debounce(function(opts) {
|
||||
Discourse.ScreenTrack.instance().scrolled();
|
||||
this.set('controller.currentPost', opts.currentPost);
|
||||
var model = this.get('controller.model');
|
||||
if (model) {
|
||||
this.set('controller.currentPost', opts.currentPost);
|
||||
}
|
||||
},500),
|
||||
|
||||
scrolled: function(){
|
||||
|
|
File diff suppressed because one or more lines are too long
2
test/javascripts/fixtures/topic_fixtures.js
Normal file
2
test/javascripts/fixtures/topic_fixtures.js
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,14 +1,25 @@
|
|||
integration("List Topics");
|
||||
|
||||
test("/", function() {
|
||||
test("Default List", function() {
|
||||
|
||||
visit("/").then(function() {
|
||||
expect(2);
|
||||
|
||||
ok(exists("#topic-list"), "The list of topics was rendered");
|
||||
ok(count('#topic-list .topic-list-item') > 0, "has topics");
|
||||
ok(exists('#topic-list .topic-list-item'), "has topics");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
test("Categories List", function() {
|
||||
|
||||
visit("/categories").then(function() {
|
||||
expect(1);
|
||||
|
||||
ok(exists('.category-list-item'), "has a list of categories");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
12
test/javascripts/integration/view_topic_test.js
Normal file
12
test/javascripts/integration/view_topic_test.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
integration("View Topic");
|
||||
|
||||
test("View a Topic", function() {
|
||||
|
||||
visit("/t/internationalization-localization/280").then(function() {
|
||||
expect(2);
|
||||
|
||||
ok(exists("#topic"), "The was rendered");
|
||||
ok(exists("#topic .topic-post"), "The topic has posts");
|
||||
});
|
||||
|
||||
});
|
|
@ -51,6 +51,14 @@ sinon.config = {
|
|||
useFakeServer: false
|
||||
};
|
||||
|
||||
window.assetPath = function() { return null };
|
||||
|
||||
var oldAjax = $.ajax;
|
||||
$.ajax = function() {
|
||||
console.error("Discourse.Ajax called in test environment (" + arguments[0] + ")");
|
||||
return oldAjax.apply(this, arguments);
|
||||
};
|
||||
|
||||
// Trick JSHint into allow document.write
|
||||
var d = document;
|
||||
d.write('<div id="qunit-scratch" style="display:none"></div>');
|
||||
|
|
Loading…
Reference in a new issue