Add: TypingTextManager
This commit is contained in:
@@ -11,7 +11,9 @@
|
||||
<div id="qunit-fixture"></div>
|
||||
|
||||
<script src="https://code.jquery.com/qunit/qunit-2.6.0.js"></script>
|
||||
<script src="../resources/js/phaser.min.js"></script>
|
||||
|
||||
<script src="../src/game/typing/lib/typing_text_manager.js"></script>
|
||||
<script src="../src/game/lib/score_manager.js"></script>
|
||||
<script src="../src/game/lib/session_storage_manager.js"></script>
|
||||
<script src="../src/game/global/global_variables.js"></script>
|
||||
|
||||
+55
-1
@@ -1,3 +1,53 @@
|
||||
//////////////////////////////////////////////////
|
||||
// TypingTextManager
|
||||
|
||||
let typingTextMan = new TypingTextManager();
|
||||
let testContent = [ "ㅃ", "ㅂ", "ㅈ", "ㅉ", "ㄸ", "ㄷ", "ㄱ", "ㄲ", "ㅅ" ];
|
||||
|
||||
QUnit.test( "TypingTextManager - add", function( assert ) {
|
||||
typingTextMan.init();
|
||||
typingTextMan.add(testContent);
|
||||
let contents = typingTextMan.getContents();
|
||||
|
||||
assert.equal(contents[0], "ㅃ", "addTextArray - ㅃ");
|
||||
assert.equal(contents[8], "ㅅ", "addTextArray - ㅅ");
|
||||
|
||||
typingTextMan.add([ "k", "l" ]);
|
||||
contents = typingTextMan.getContents();
|
||||
|
||||
assert.equal(contents[9], "k", "addTextArray - k");
|
||||
assert.equal(contents[10], "l", "addTextArray - l");
|
||||
});
|
||||
|
||||
QUnit.test( "TypingTextManager - slice", function( assert ) {
|
||||
typingTextMan.init();
|
||||
typingTextMan.add(testContent);
|
||||
typingTextMan.slice(0, 3);
|
||||
let contents = typingTextMan.getContents();
|
||||
|
||||
assert.equal(contents[0], "ㅃ", "slice - ㅃ");
|
||||
assert.equal(contents[2], "ㅈ", "slice - ㅈ");
|
||||
assert.equal(contents[3], undefined, "slice - ㅉ");
|
||||
});
|
||||
|
||||
QUnit.test( "TypingTextManager - makePracticeContents", function( assert ) {
|
||||
typingTextMan.makePracticeContents(testContent, 2);
|
||||
let contents = typingTextMan.getContents();
|
||||
|
||||
assert.equal(contents[0], "ㅃ", "makePracticeContents - ㅃ");
|
||||
assert.equal(contents[8], "ㅅ", "makePracticeContents - ㅅ");
|
||||
assert.equal(contents.length, testContent.length * 3, "makePracticeContents - length");
|
||||
});
|
||||
|
||||
QUnit.test( "TypingTextManager - makeTestContents", function( assert ) {
|
||||
typingTextMan.makeTestContents(testContent);
|
||||
let contents = typingTextMan.getContents();
|
||||
|
||||
assert.equal(contents.length, testContent.length, "makeTestContents - length");
|
||||
});
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// KeyMapper
|
||||
|
||||
@@ -71,9 +121,13 @@ QUnit.test( "KeyMapper - isShiftText", function( assert ) {
|
||||
assert.equal(keyMapper.isShiftText("m"), false, "isShiftText - m");
|
||||
assert.equal(keyMapper.isShiftText("M"), true, "isShiftText - M");
|
||||
|
||||
assert.equal(keyMapper.isShiftText("ㅁ"), false, "isShiftText - ㅁ");
|
||||
assert.equal(keyMapper.isShiftText("ㄴ"), false, "isShiftText - ㄴ");
|
||||
assert.equal(keyMapper.isShiftText("ㅇ"), false, "isShiftText - ㅇ");
|
||||
|
||||
assert.equal(keyMapper.isShiftText("ㅂ"), false, "isShiftText - ㅂ");
|
||||
assert.equal(keyMapper.isShiftText("ㅃ"), true, "isShiftText - ㅃ");
|
||||
assert.equal(keyMapper.isShiftText("ㅡ"), true, "isShiftText - ㅡ");
|
||||
assert.equal(keyMapper.isShiftText("ㅡ"), false, "isShiftText - ㅡ");
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user