This repository was archived by the owner on Mar 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#125: added parse method test for names.js and default, minor updates;
- Loading branch information
Showing
4 changed files
with
53 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
describe ( 'Names.js tests', function () { | ||
|
||
it ( 'should have a idrinth variable in scope', function () { | ||
expect ( idrinth ).toBeDefined (); | ||
} ); | ||
|
||
|
||
it ( 'should check default data is valid, and empty', function () { | ||
expect ( idrinth.names.users ).toEqual ( {} ); | ||
expect ( idrinth.names.classes ).toEqual ( {} ); | ||
expect ( idrinth.names.guilds ).toEqual ( {} ); | ||
expect ( idrinth.names.counter ).toEqual ( 0 ); | ||
} ); | ||
|
||
describe ( "Names parse method", function () { | ||
//<span class="username chat_message_window_username ign dotdm_1484406507967" | ||
// username="arkamat" dotdxname="arkamat" oncontextmenu="return false;">K2 mat</span> | ||
|
||
it ( "Should get attribute with name dotdxname", function () { | ||
var span = document.createElement ( "span" ); | ||
span.className = 'username chat_message_window_username ign'; | ||
span.setAttribute ( "dotdxname", "testcharacterDTX" ); | ||
span.innerHTML = "K2 TestCharacter"; | ||
|
||
expect ( idrinth.names.parse ( span ) ).toEqual ( "testcharacterDTX" ); | ||
} ); | ||
|
||
it ( "Should get attribute with name username", function () { | ||
|
||
var span = document.createElement ( "span" ); | ||
span.className = 'username'; | ||
span.setAttribute ( "username", "testcharacterUSN" ); | ||
span.innerHTML = "K2 TestCharacter"; | ||
|
||
expect ( idrinth.names.parse ( span ) ).toEqual ( "testcharacterUSN" ); | ||
} ); | ||
|
||
it ( "Should get default attribute", function () { | ||
var span = document.createElement ( "span" ); | ||
span.innerHTML = "K2 TestCharacter"; | ||
|
||
expect ( idrinth.names.parse ( span ) ).toEqual ( "K2 TestCharacter" ); | ||
} ); | ||
|
||
} ); | ||
|
||
} ); |