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

Commit

Permalink
Merge remote-tracking branch 'origin/asdsad' into asdsad
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/mods/land.js
#	tests/mods/land.spec.js
  • Loading branch information
w20k committed Jan 14, 2017
2 parents 5d01b9b + 6953752 commit 236c2e9
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mods/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ idrinth.text = {
idrinth.settings.change( "lang", language );
if ( language === "en" ) {
idrinth.text.initialized = true;
idrinth.text.data = JSON.parse ( '###LANG###' );
return;
}
idrinth.core.ajax.runHome ( 'userscript-translation/'+language+'/###RELOAD-VERSION###/', function ( file ) {
Expand Down Expand Up @@ -43,11 +44,11 @@ idrinth.text = {
* See languages/en.json for an example
* @type {object}
*/
data: JSON.parse ( '###LANG###' ),
data: {},
/**
* returns the translation of a provided key or an error-message if no
* matching translation is found
* @param string key
* @param {string} key
* @returns {string}
*/
get: function ( key ) {
Expand Down
61 changes: 61 additions & 0 deletions tests/mods/settingsSpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
describe ( 'Settings.js tests', function () {

it ( 'should have a idrinth variable in scope', function () {
expect ( idrinth ).toBeDefined ();
} );

it ( 'should have default values defined', function () {
var defaults = {
raids: false,
favs: '',
factor: true,
moveLeft: false,
minimalist: false,
chatHiddenOnStart: true,
names: true,
timeout: 5000,
loadtime: 5000,
windows: 3,
warBottom: false,
landMax: true,
chatting: true,
chatuser: '',
newgroundLoad: 30,
chatpass: '',
isWorldServer: false,
alarmTime: '8:0',
alarmActive: false,
bannedRaids: {},
language: 'en',
notification: {
mention: true,
message: true,
raid: true
},
land: {
cornfield: 0,
stable: 0,
barn: 0,
store: 0,
pub: 0,
inn: 0,
tower: 0,
fort: 0,
castle: 0,
gold: 0
}
};

var copySettings = JSON.parse ( JSON.stringify ( idrinth.settings ) );

//CleanUP functions -> not part of the test
for ( var i in copySettings ) {
if ( copySettings.hasOwnProperty ( i ) && typeof copySettings[ i ] === 'function' ) {
delete copySettings[ i ];
}
}

expect ( copySettings ).toEqual ( defaults );
} );

} );

0 comments on commit 236c2e9

Please sign in to comment.