BoundsMatchersSpec.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import {
  2. create
  3. } from 'lib/model';
  4. describe('matchers/BoundsMatchers', function() {
  5. describe('bounds', function() {
  6. it('should .have.bounds() with Bounds', function() {
  7. // given
  8. var bounds = { x: 100, y: 100, width: 200, height: 200 },
  9. expectedBounds = { x: 100, y: 100, width: 200, height: 200 };
  10. // then
  11. expect(bounds).to.have.bounds(expectedBounds);
  12. });
  13. it('should .not.have.bounds() with Bounds', function() {
  14. // given
  15. var bounds = { x: 100, y: 100, width: 200, height: 200 },
  16. expectedBounds = { x: 50, y: 100, width: 200, height: 200 };
  17. // then
  18. expect(bounds).not.to.have.bounds(expectedBounds);
  19. });
  20. it('should .have.bounds() with Shape', function() {
  21. // given
  22. var element = create('shape', {
  23. id: 'someShape',
  24. x: 100, y: 100,
  25. width: 200, height: 200
  26. });
  27. var expectedBounds = {
  28. x: 100, y: 100,
  29. width: 200, height: 200
  30. };
  31. // then
  32. expect(element).to.have.bounds(expectedBounds);
  33. });
  34. it('should .not.have.bounds() with Shape', function() {
  35. // given
  36. var element = create('shape', {
  37. id: 'someShape',
  38. x: 100, y: 100,
  39. width: 200, height: 200
  40. });
  41. var expectedBounds = {
  42. x: 50, y: 100,
  43. width: 200, height: 200
  44. };
  45. // then
  46. expect(element).not.to.have.bounds(expectedBounds);
  47. });
  48. });
  49. });