Skip to content

Commit

Permalink
[Frontend] Updated tests and examples for glyph refactoring
Browse files Browse the repository at this point in the history
Fixes #1047
WIP: Fixing test cases: fixed test in Timers that was expecting
glyph return;
  • Loading branch information
charlesh88 committed Jul 23, 2016
1 parent 2231f8e commit dd84177
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 24 deletions.
2 changes: 1 addition & 1 deletion example/profiling/src/DigestIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ define(
getCssClass: function () {
return "icon-connectivity";
},
getGlyphClass: function () {
getCssClass: function () {
return undefined;
},
getText: function () {
Expand Down
13 changes: 1 addition & 12 deletions example/profiling/src/WatchIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,14 @@ define(

return {
/**
* Get the glyph CSS class (single character used as an icon)
* Get the CSS class (single character used as an icon)
* to display in this indicator. This will return ".",
* which should appear as a database icon.
* @returns {string} the character of the database icon
*/
getCssClass: function () {
return "icon-database";
},
/**
* Get the name of the CSS class to apply to the glyph.
* This is used to color the glyph to match its
* state (one of ok, caution or err)
* @returns {string} the CSS class to apply to this glyph
*/
getGlyphClass: function () {
return (watches > 2000) ? "caution" :
(watches < 1000) ? "ok" :
undefined;
},
/**
* Get the text that should appear in the indicator.
* @returns {string} brief summary of connection status
Expand Down
3 changes: 0 additions & 3 deletions example/worker/src/FibonacciIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ define(
getText: function () {
return latest;
},
getGlyphClass: function () {
return "";
},
getDescription: function () {
return "";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ define(
});

it("provides displayable metadata", function () {
expect(action.getMetadata().glyph).toBeDefined();
expect(action.getMetadata().cssclass).toBeDefined();
});

});
Expand Down
5 changes: 1 addition & 4 deletions platform/identity/src/IdentityIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ define(
}

IdentityIndicator.prototype.getCssClass = function () {
return "icon-person";
};
IdentityIndicator.prototype.getGlyphClass = function () {
return undefined;
return this.text && "icon-person";
};
IdentityIndicator.prototype.getText = function () {
return this.text;
Expand Down
3 changes: 0 additions & 3 deletions platform/identity/test/IdentityIndicatorSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,20 @@ define(
name: "A User"
});
expect(indicator.getCssClass()).toEqual("icon-person");
expect(indicator.getGlyphClass()).toBeUndefined();
expect(indicator.getText()).toEqual("A User");
expect(indicator.getDescription().indexOf("testuserid"))
.not.toEqual(-1);
});

it("shows nothing while no user information is available", function () {
expect(indicator.getCssClass()).toBeUndefined();
expect(indicator.getGlyphClass()).toBeUndefined();
expect(indicator.getText()).toBeUndefined();
expect(indicator.getDescription()).toBeUndefined();
});

it("shows nothing when there is no identity information", function () {
mockPromise.then.mostRecentCall.args[0](undefined);
expect(indicator.getCssClass()).toBeUndefined();
expect(indicator.getGlyphClass()).toBeUndefined();
expect(indicator.getText()).toBeUndefined();
expect(indicator.getDescription()).toBeUndefined();
});
Expand Down

0 comments on commit dd84177

Please sign in to comment.