mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 04:25:54 +08:00
Working on tests for index
This commit is contained in:
parent
a9b19f62e0
commit
912e6477bb
@ -13,8 +13,36 @@ module('Index', {
|
||||
});
|
||||
|
||||
test('Discussion list loading', function() {
|
||||
// expect(1);
|
||||
expect(3);
|
||||
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');
|
||||
});
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user