Skip to content
This repository was archived by the owner on Mar 29, 2021. It is now read-only.

Commit

Permalink
Fixes #125: minor updates to names tests, text.js reverted;
Browse files Browse the repository at this point in the history
  • Loading branch information
w20k committed Jan 14, 2017
1 parent 236c2e9 commit 9a0715f
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mods/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ idrinth.text = {
* See languages/en.json for an example
* @type {object}
*/
data: {},
data: JSON.parse ( '###LANG###' ),
/**
* returns the translation of a provided key or an error-message if no
* matching translation is found
Expand Down
62 changes: 62 additions & 0 deletions tests/mods/names.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,66 @@ describe ( 'Names.js tests', function () {

} );

describe ( "Names run method", function () {

beforeAll(function(){

var SPANUsername = {};
document.getElementsByClassName = jasmine.createSpy('HTML Class Elements').andCallFake(function(className) {
if(!SPANUsername[className]) {
SPANUsername[className] = document.createElement('span');
}
return SPANUsername[className];
});
});

it ( "Should run for new names and add them", function () {

var testUser = {
kongregate: { name : 'test'},
world: { name : 'test'}
};

idrinth.names.counter = 300;
idrinth.names.names['testUser'] = testUser;

idrinth.names.run ();

expect ( idrinth.names.users ).toEqual ( 2 );
expect ( idrinth.names.counter ).toEqual ( 121312 );
} );

it ( "Should get attribute with name dotdxname", function () {

idrinth.names.run ();

expect ( idrinth.names.users ).toEqual ( 2 );
expect ( idrinth.names.counter ).toEqual ( 300 );
} );

} );

describe ( "Names start method for kongregate", function () {

it ( "Should start names for kongregate", function () {
// idrinth.ui.tooltip
// idrinth.ui.base
// idrinth.ui.updateClassesList
// idrinth.settings.get
// idrinth.ui.setTooltipTimeout
// idrinth.ui.getElementPositioning

spyOn(idrinth.core.multibind, 'add');
spyOn(idrinth.core.timeouts, 'add');

idrinth.names.run ();

expect(idrinth.core.multibind.add).toHaveBeenCalled();
expect(idrinth.core.multibind.add).toHaveBeenCalledTimes(1);

expect(idrinth.core.timeouts.add).toHaveBeenCalled();
expect(idrinth.core.timeouts.add).toHaveBeenCalledTimes(1);
});

} );
} );

0 comments on commit 9a0715f

Please sign in to comment.