Container.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. topSuite("Ext.draw.Container", function() {
  2. beforeEach(function() {
  3. // Silence warnings regarding Sencha download server
  4. spyOn(Ext.log, 'warn');
  5. });
  6. describe("'sprites' config", function () {
  7. var container;
  8. afterEach(function () {
  9. Ext.destroy(container);
  10. });
  11. it("should accept sprite configs.", function () {
  12. container = new Ext.draw.Container({
  13. sprites: {
  14. type: 'rect',
  15. x: 10
  16. }
  17. });
  18. var sprite = container.getSprites()[0];
  19. expect(sprite.isSprite).toBe(true);
  20. expect(sprite.type).toBe('rect');
  21. expect(sprite.attr.x).toEqual(10);
  22. });
  23. it("should accept sprite instances.", function () {
  24. container = new Ext.draw.Container({
  25. sprites: new Ext.draw.sprite.Rect({
  26. x: 10
  27. })
  28. });
  29. var sprite = container.getSprites()[0];
  30. expect(sprite.isSprite).toBe(true);
  31. expect(sprite.type).toBe('rect');
  32. expect(sprite.attr.x).toEqual(10);
  33. });
  34. it("should put sprites into the specified surface or the 'main' one.", function () {
  35. container = new Ext.draw.Container({
  36. sprites: {
  37. type: 'rect',
  38. surface: 'test',
  39. x: 10
  40. }
  41. });
  42. var sprite = container.getSurface('test').getItems()[0];
  43. expect(sprite.isSprite).toBe(true);
  44. expect(sprite.type).toBe('rect');
  45. expect(sprite.attr.x).toEqual(10);
  46. });
  47. });
  48. });