Permalink
Browse files

remove wf-loading when the 'inactive' event is triggered because of a…

… timeout
  • Loading branch information...
1 parent 4287977 commit 3b642ccf9f23342c0cdcf7a619e98a02632702e7 @rcarver rcarver committed Aug 4, 2010
Showing with 20 additions and 1 deletion.
  1. +4 −0 CHANGELOG
  2. +12 −1 src-test/core/eventdispatchertest.js
  3. +1 −0 src-test/core/fonttest.js
  4. +3 −0 src/core/eventdispatcher.js
View
@@ -1,3 +1,7 @@
+master
+* Fix that wf-loading was not removed in the case of wf-inactive because of
+ a timeout.
+
v1.0.6 (July 20, 2010)
* Add JsDoc comments and type annotations for the Closure compiler. Fixes
several small bugs caught by the compiler in doing so.
@@ -51,7 +51,7 @@ EventDispatcherTest.prototype.testClassNamesOnActiveLoad = function() {
assertEquals('ns-myfamily-n4-active ns-active', this.fakeHtmlElement_.className);
};
-EventDispatcherTest.prototype.testClassNamesOnInactiveLoad = function() {
+EventDispatcherTest.prototype.testClassNamesOnInactiveFontButActive = function() {
this.eventDispatcher_.dispatchLoading();
assertEquals('ns-loading', this.fakeHtmlElement_.className);
this.eventDispatcher_.dispatchFontLoading('My Family', 'n4');
@@ -88,6 +88,17 @@ EventDispatcherTest.prototype.testEventsOnInactiveLoad = function() {
assertTrue(this.activeEventCalled_);
};
+EventDispatcherTest.prototype.testClassNamesOnInactiveLoad = function() {
+ this.eventDispatcher_.dispatchLoading();
+ assertEquals('ns-loading', this.fakeHtmlElement_.className);
+ this.eventDispatcher_.dispatchFontLoading('My Family', 'n4');
+ assertEquals('ns-loading ns-myfamily-n4-loading', this.fakeHtmlElement_.className);
+ this.eventDispatcher_.dispatchFontInactive('My Family', 'n4');
+ assertEquals('ns-loading ns-myfamily-n4-inactive', this.fakeHtmlElement_.className);
+ this.eventDispatcher_.dispatchInactive();
+ assertEquals('ns-myfamily-n4-inactive ns-inactive', this.fakeHtmlElement_.className);
+};
+
EventDispatcherTest.prototype.testClassNamesOnInactive = function() {
this.eventDispatcher_.dispatchInactive();
assertEquals('ns-inactive', this.fakeHtmlElement_.className);
@@ -4,6 +4,7 @@ FontTest.prototype.setUp = function() {
this.fakeHtmlElement_ = { className: '' };
this.fakeDomHelper_ = {
appendClassName: function() {},
+ removeClassName: function() {},
createElement: function(name) {
return document.createElement(name);
},
@@ -94,6 +94,9 @@ webfont.EventDispatcher.prototype.dispatchFontInactive = function(fontFamily, fo
};
webfont.EventDispatcher.prototype.dispatchInactive = function() {
+ this.domHelper_.removeClassName(this.htmlElement_,
+ this.cssClassName_.build(
+ this.namespace_, webfont.EventDispatcher.LOADING));
this.domHelper_.appendClassName(this.htmlElement_,
this.cssClassName_.build(
this.namespace_, webfont.EventDispatcher.INACTIVE));

0 comments on commit 3b642cc

Please sign in to comment.