drake-api.js 1.0 KB

123456789101112131415161718192021222324252627
  1. 'use strict';
  2. var test = require('tape');
  3. var dragula = require('..');
  4. test('drake can be instantiated without throwing', function (t) {
  5. t.doesNotThrow(drakeFactory, 'calling dragula() without arguments does not throw');
  6. t.end();
  7. function drakeFactory () {
  8. return dragula();
  9. }
  10. });
  11. test('drake has expected api properties', function (t) {
  12. var drake = dragula();
  13. t.ok(drake, 'drake is not null');
  14. t.equal(typeof drake, 'object', 'drake is an object');
  15. t.ok(Array.isArray(drake.containers), 'drake.containers is an array');
  16. t.equal(typeof drake.start, 'function', 'drake.start is a method');
  17. t.equal(typeof drake.end, 'function', 'drake.end is a method');
  18. t.equal(typeof drake.cancel, 'function', 'drake.cancel is a method');
  19. t.equal(typeof drake.remove, 'function', 'drake.remove is a method');
  20. t.equal(typeof drake.destroy, 'function', 'drake.destroy is a method');
  21. t.equal(typeof drake.dragging, 'boolean', 'drake.dragging is a boolean');
  22. t.equal(drake.dragging, false, 'drake.dragging is initialized as false');
  23. t.end();
  24. });