select-cell.js 662 B

123456789101112131415161718
  1. QUnit.test( 'selectCell', function( assert ) {
  2. 'use strict';
  3. var gallery = document.querySelector('#select-cell');
  4. var cellElems = gallery.querySelectorAll('.cell');
  5. var flkty = new Flickity( gallery, {
  6. groupCells: true, // groups of 3
  7. });
  8. flkty.selectCell( 3 );
  9. assert.equal( flkty.selectedIndex, 1, 'selectCell number' );
  10. flkty.selectCell( cellElems[1] );
  11. assert.equal( flkty.selectedIndex, 0, 'selectCell element' );
  12. flkty.selectCell('.select-cell__6');
  13. assert.equal( flkty.selectedIndex, 2, 'selectCell selector string' );
  14. flkty.selectCell('none');
  15. assert.equal( flkty.selectedIndex, 2, 'selectCell bad string is okay' );
  16. });