ClipboardSpec.js 787 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {
  2. bootstrapDiagram,
  3. inject
  4. } from 'test/TestHelper';
  5. import clipboardModule from 'lib/features/clipboard';
  6. describe('features/clipboard', function() {
  7. var contents = { foo: 'bar' };
  8. beforeEach(bootstrapDiagram({
  9. modules: [ clipboardModule ]
  10. }));
  11. it('should set element to clipboard', inject(function(clipboard) {
  12. // when
  13. clipboard.set(contents);
  14. var result = clipboard.get();
  15. // then
  16. expect(result).to.eql(contents);
  17. expect(clipboard.isEmpty()).to.be.false;
  18. }));
  19. it('should clear the clipboard', inject(function(clipboard) {
  20. // when
  21. clipboard.set(contents);
  22. var oldClipboard = clipboard.clear();
  23. // then
  24. expect(clipboard.isEmpty()).to.be.true;
  25. expect(oldClipboard).to.contain(contents);
  26. }));
  27. });