not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.6 KiB

  1. define(["sugar-web/graphics/icon"], function (icon) {
  2. 'use strict';
  3. describe("icon", function () {
  4. var wasLoaded;
  5. var iconUrlResult;
  6. it("should be able to change icon more than once", function () {
  7. var elem = document.createElement('div');
  8. var iconUrl;
  9. function callback(url) {
  10. iconUrlResult = url;
  11. wasLoaded = true;
  12. }
  13. runs(function () {
  14. wasLoaded = false;
  15. iconUrl = "/base/graphics/icons/actions/dialog-ok-active.svg";
  16. var iconInfo = {
  17. "uri": iconUrl,
  18. "strokeColor": '#B20008',
  19. "fillColor": '#FF2B34'
  20. };
  21. icon.load(iconInfo, callback);
  22. });
  23. waitsFor(function () {
  24. return wasLoaded;
  25. }, "icon loaded");
  26. runs(function () {
  27. expect(iconUrlResult).not.toBe(iconUrl);
  28. });
  29. runs(function () {
  30. wasLoaded = false;
  31. iconUrl = iconUrlResult;
  32. var iconInfo = {
  33. "uri": iconUrl,
  34. "strokeColor": '#FF2B34',
  35. "fillColor": '#B20008'
  36. };
  37. icon.load(iconInfo, callback);
  38. });
  39. waitsFor(function () {
  40. return wasLoaded;
  41. }, "icon loaded");
  42. runs(function () {
  43. expect(iconUrlResult).not.toBe(iconUrl);
  44. });
  45. });
  46. });
  47. });