mirror of
https://github.com/keymanapp/keyman.git
synced 2026-11-05 02:24:56 +00:00
change(web): adjust keyboard-error page for testing prior commit's changes
This commit is contained in:
parent
9b47e3f824
commit
ea474d2250
2 changed files with 48 additions and 34 deletions
|
|
@ -4,39 +4,49 @@
|
|||
This script is designed to test KeymanWeb error message handling.
|
||||
*/
|
||||
|
||||
function loadKeyboards()
|
||||
{
|
||||
var kmw=keyman;
|
||||
function loadKeyboards() {
|
||||
var kmw=keyman;
|
||||
|
||||
// We start by adding a keyboard correctly. It's best to include a 'control' in our experiment.
|
||||
kmw.addKeyboards({id:'us',name:'English',languages:{id:'en',name:'English'},
|
||||
filename:'../us-1.0.js'});
|
||||
|
||||
// We start by adding a keyboard correctly. It's best to include a 'control' in our experiment.
|
||||
kmw.addKeyboards({id:'us',name:'English',languages:{id:'en',name:'English'},
|
||||
filename:'../us-1.0.js'});
|
||||
|
||||
// Insert a keyboard that cannot be found.
|
||||
kmw.addKeyboards({id:'lao_2008_basic',name:'wrong-filename',
|
||||
languages:{
|
||||
id:'lo',name:'debugging',region:'Asia',
|
||||
font:{family:'LaoWeb',source:['../font/saysettha_web.ttf','../font/saysettha_web.woff','../font/saysettha_web.eot']}
|
||||
},
|
||||
filename:'./missing_file.js' // Intentional error - the file doesn't exist, so the <script> tag will raise an error event.
|
||||
});
|
||||
|
||||
// Insert a keyboard that will generate a timing error.
|
||||
kmw.addKeyboards({id:'unparsable',name:'non-parsable',
|
||||
languages:{
|
||||
id:'lo',name:'debugging',region:'Asia',
|
||||
font:{family:'LaoWeb',source:['../font/saysettha_web.ttf','../font/saysettha_web.woff','../font/saysettha_web.eot']}
|
||||
},
|
||||
filename:'./unparsable.js' // Intentional error - the file has no parsable keyboard, so while the <script> tag will load,
|
||||
// registration will fail.
|
||||
});
|
||||
// Insert a keyboard that cannot be found.
|
||||
kmw.addKeyboards({id:'lao_2008_basic',name:'wrong-filename',
|
||||
languages:{
|
||||
id:'lo',name:'debugging',region:'Asia',
|
||||
font:{family:'LaoWeb',source:['../font/saysettha_web.ttf','../font/saysettha_web.woff','../font/saysettha_web.eot']}
|
||||
},
|
||||
filename:'./missing_file.js' // Intentional error - the file doesn't exist, so the <script> tag will raise an error event.
|
||||
});
|
||||
|
||||
// Insert a keyboard that will generate a timing error.
|
||||
kmw.addKeyboards({id:'unparsable',name:'non-parsable',
|
||||
languages:{
|
||||
id:'lo',name:'debugging',region:'Asia',
|
||||
font:{family:'LaoWeb',source:['../font/saysettha_web.ttf','../font/saysettha_web.woff','../font/saysettha_web.eot']}
|
||||
},
|
||||
filename:'./unparsable.js' // Intentional error - the file has no parsable keyboard, so while the <script> tag will load,
|
||||
// registration will fail.
|
||||
});
|
||||
|
||||
// Insert a keyboard that will generate a timing error.
|
||||
kmw.addKeyboards({id:'timeout',name:'timeout',
|
||||
languages:{
|
||||
id:'lo',name:'debugging',region:'Asia',
|
||||
font:{family:'LaoWeb',source:['../font/saysettha_web.ttf','../font/saysettha_web.woff','../font/saysettha_web.eot']}
|
||||
},
|
||||
filename:'./timeout.js' // Intentional (simulated) error - the file never loads, simulating a server timeout.
|
||||
});
|
||||
}
|
||||
// Insert a keyboard that will generate a timing error.
|
||||
kmw.addKeyboards({id:'timeout',name:'timeout',
|
||||
languages:{
|
||||
id:'lo',name:'debugging',region:'Asia',
|
||||
font:{family:'LaoWeb',source:['../font/saysettha_web.ttf','../font/saysettha_web.woff','../font/saysettha_web.eot']}
|
||||
},
|
||||
filename:'./timeout.js' // Intentional (simulated) error - the file never loads, simulating a server timeout.
|
||||
});
|
||||
}
|
||||
|
||||
function badStubRequest(entry) {
|
||||
switch(entry) {
|
||||
case 1:
|
||||
kmw.addKeyboards('1nval1d5tub@reque5t');
|
||||
break;
|
||||
case 2:
|
||||
keyman.addKeyboardsForLanguage(['PigLatn','1337sp34k']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -72,6 +72,10 @@
|
|||
<h3>or in this input field:</h3>
|
||||
<input class='test' value='' placeholder='or here'/>
|
||||
|
||||
<h3>Trigger stub registration errors:</h3>
|
||||
<input type='button' id='btnStub1' onclick='badStubRequest(1);' value='Request single stub' />
|
||||
<input type='button' id='btnStub2' onclick='badStubRequest(2);' value='Request stubs for two invalid languages' />
|
||||
|
||||
<!-- The following elements show how the language menu can be dynamically extended at any time -->
|
||||
<h3>Add a keyboard by keyboard name:</h3>
|
||||
<input type='input' id='kbd_id1' class='kmw-disabled' onkeypress="clickOnEnter(event,1);"/>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue