mirror of
https://github.com/flarum/core.git
synced 2025-07-25 18:51:40 +02:00
Working on tests for index
This commit is contained in:
@@ -13,8 +13,36 @@ module('Index', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Discussion list loading', function() {
|
test('Discussion list loading', function() {
|
||||||
// expect(1);
|
expect(3);
|
||||||
visit('/').then(function() {
|
visit('/').then(function() {
|
||||||
// equal(find('.discussions-list').length, 1, "Page contains list of discussions");
|
equal(find('.discussions-list').length, 1, 'Page contains list of discussions');
|
||||||
|
equal(find('.discussions-list li').length, 20, 'There are 20 discussions in the list');
|
||||||
|
|
||||||
|
click('.control-loadMore').then(function() {
|
||||||
|
equal(find('.discussions-list li').length, 40, 'There are 40 discussions in the list');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Discussion list sorting', function() {
|
||||||
|
expect(1);
|
||||||
|
visit('/').then(function() {
|
||||||
|
fillIn('.control-sort select', 'replies').then(function() {
|
||||||
|
var discussions = find('.discussions-list li');
|
||||||
|
var good = true;
|
||||||
|
var getCount = function(item) {
|
||||||
|
return parseInt(item.find('.count strong').text());
|
||||||
|
};
|
||||||
|
var previousCount = getCount(discussions.eq(0));
|
||||||
|
for (var i = 1; i < discussions.length; i++) {
|
||||||
|
var count = getCount(discussions.eq(i));
|
||||||
|
if (count > previousCount) {
|
||||||
|
good = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
previousCount = count;
|
||||||
|
}
|
||||||
|
ok(good, 'Discussions are listed in order of reply count');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
Reference in New Issue
Block a user