filepicker.js 862 B

123456789101112131415161718192021222324252627282930313233343536
  1. define([
  2. 'webuploader/preset/all'
  3. ], function( Base ) {
  4. var $fixture;
  5. module( 'FilePicker', {
  6. setup: function() {
  7. $fixture = $('#qunit-fixture');
  8. },
  9. teardown: function() {
  10. $fixture.empty();
  11. $fixture = null;
  12. }
  13. });
  14. test( 'Test initialize', 3, function() {
  15. var $btns, $pickers;
  16. $fixture.append('<div class="btn">Button One</div><div class="btn">Button Two</div>');
  17. $btns = $fixture.find('.btn').each(function( i ) {
  18. Base.create({
  19. pick: this
  20. });
  21. });
  22. $pickers = $btns.find('.webuploader-pick');
  23. equal( $pickers.length, 2, 'The length should be 2.' );
  24. equal( $pickers.eq(0).text(), 'Button One', 'ok' );
  25. equal( $pickers.eq(1).text(), 'Button Two', 'ok' );
  26. });
  27. });