Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Had to update test to enable repeater after being disabled.
Browse files Browse the repository at this point in the history
Fixes #1474
  • Loading branch information
BenjaminNeilDavis committed Sep 24, 2015
1 parent cbaf4c4 commit f5a1f39
Showing 1 changed file with 32 additions and 26 deletions.
58 changes: 32 additions & 26 deletions test/repeater-list-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,34 +155,40 @@ define(function(require){
var count = 0;
var $first;

$repeater.on('rendered.fu.repeater', function(e, data){
setTimeout(function(){
$repeater.repeater('enable');
var options = data.options;
count++;
switch(count){
case 1:
$first = $repeater.find('.repeater-list thead .repeater-list-heading:first');
$first.click();
break;
case 2:
equal(($first.hasClass('sorted') && $first.find('span').hasClass('glyphicon-chevron-up')), true, 'asc sorted header has appropriate class and icon');
equal(options.sortDirection, 'asc', 'dataSource passed appropriate sortDirection value');
equal(options.sortProperty, 'commonName', 'dataSource passed appropriate sortProperty value');
$first.click();
break;
case 3:
equal(($first.hasClass('sorted') && $first.find('span').hasClass('glyphicon-chevron-down')), true, 'desc sorted header has appropriate class and icon');
equal(options.sortDirection, 'desc', 'dataSource passed appropriate sortDirection value');
equal(options.sortProperty, 'commonName', 'dataSource passed appropriate sortProperty value');
$first.click();
break;
case 4:
equal($first.hasClass('sorted'), false, 'previously sorted header reverted to non-sorted');
equal(options.sortDirection, undefined, 'dataSource passed appropriate sortDirection value');
equal(options.sortProperty, undefined, 'dataSource passed appropriate sortProperty value');
$repeater.off('loaded.fu.repeater');
start();
break;
}
}, 0);
});
$repeater.on('loaded.fu.repeater', function(e, options){
count++;

switch(count){
case 1:
$first = $repeater.find('.repeater-list thead .repeater-list-heading:first');
$first.click();
break;
case 2:
equal(($first.hasClass('sorted') && $first.find('span').hasClass('glyphicon-chevron-up')), true, 'asc sorted header has appropriate class and icon');
equal(options.sortDirection, 'asc', 'dataSource passed appropriate sortDirection value');
equal(options.sortProperty, 'commonName', 'dataSource passed appropriate sortProperty value');
$first.click();
break;
case 3:
equal(($first.hasClass('sorted') && $first.find('span').hasClass('glyphicon-chevron-down')), true, 'desc sorted header has appropriate class and icon');
equal(options.sortDirection, 'desc', 'dataSource passed appropriate sortDirection value');
equal(options.sortProperty, 'commonName', 'dataSource passed appropriate sortProperty value');
$first.click();
break;
case 4:
equal($first.hasClass('sorted'), false, 'previously sorted header reverted to non-sorted');
equal(options.sortDirection, undefined, 'dataSource passed appropriate sortDirection value');
equal(options.sortProperty, undefined, 'dataSource passed appropriate sortProperty value');
$repeater.off('loaded.fu.repeater');
start();
break;
}
});

$repeater.repeater({
Expand Down

0 comments on commit f5a1f39

Please sign in to comment.