Lively Kernel canvas
//
DraftingSpellCheckerStage240
AftertheprototypeinFabrikworked,letsmoveallthecodeintoalayerandtransformtheexampleintoTests.1
checker=newSpellChecker();source=checker.querySpellCheckService("HelloWarld");corrections=checker.extractSpellCheck(source)3
r=newWebResource
Wikicontroltruetrue
http://lively-kernel.org/repository/webwerkstatt/lively/truetruetruetruetrue
falsetruetrue
false00.11truefalsetruetrue
codebasefalsenulltruefalsefalsetrue
localfalsenulltruefalsefalsetrue
Base.js(notparsed)falsetruefalsetrue0false
bindings.js(notparsed)falsetruefalsetrue0false
CanvasExpt.js(notparsed)falsetruefalsetrue0false
ChangeSet.js(notparsed)falsetruefalsetrue0false
Connector.js(notparsed)falsetruefalsetrue0false
Contributions.js(notparsed)falsetruefalsetrue0false
Core.js(notparsed)falsetruefalsetrue0false
Data.js(notparsed)falsetruefalsetrue0false
defaultconfig.js(notparsed)falsetruefalsetrue0false
demofx.js(notparsed)falsetruefalsetrue0false
EmuDom.js(notparsed)falsetruefalsetrue0false
Examples.js(notparsed)falsetruefalsetrue0false
Fabrik.js(notparsed)falsetruefalsetrue0false
FileUploadWidget.js(notparsed)falsetruefalsetrue0false
Graffle.js(notparsed)falsetruefalsetrue0false
GridLayout.js(notparsed)falsetruefalsetrue0false
Helper.js(notparsed)falsetruefalsetrue0false
ide.js(notparsed)falsetruefalsetrue0false
JSON.js(notparsed)falsetruefalsetrue0false
LayerableMorphs.js(notparsed)falsetruefalsetrue0false
lk-js-parser.ometa(notparsed)falsetruefalsetrue0false
LKFileParser.js(notparsed)falsetruefalsetrue0false
LKFileParser.ometa(notparsed)falsetruefalsetrue0false
LKWiki.js(notparsed)falsetruefalsetrue0false
Localcodefalsetruefalsetrue0false
localconfig.js(notparsed)falsetruefalsetrue0false
Main.js(notparsed)falsetruefalsetrue0false
miniprototype.js(notparsed)falsetruefalsetrue0false
Network.js(notparsed)falsetruefalsetrue0false
obsolete.js(notparsed)falsetruefalsetrue0false
Ometa.js(notparsed)falsetruefalsetrue0false
phone.js(notparsed)falsetruefalsetrue0false
Presentation.js(notparsed)falsetruefalsetrue0false
rhino-compat.js(notparsed)falsetruefalsetrue0false
scene.js(notparsed)falsetruefalsetrue0false
simpleMain.js(notparsed)falsetruefalsetrue0false
SmalltalkParser.js(notparsed)falsetruefalsetrue0false
SmalltalkParser.ometa(notparsed)falsetruefalsetrue0false
SmalltalkParserSupport.js(notparsed)falsetruefalsetrue0false
SpellChecker.jsfalsetruefalsetrue0false
Storage.js(notparsed)falsetruefalsetrue0false
Styles.js(notparsed)falsetruefalsetrue0false
SyntaxHighlighting.js(notparsed)falsetruefalsetrue0false
TabCompletion.js(notparsed)falsetruefalsetrue0false
TestFramework.js(notparsed)falsetruefalsetrue0false
TestRunnerExtensions.js(notparsed)falsetruefalsetrue0false
Text.js(notparsed)falsetruefalsetrue0false
TileScripting.js(notparsed)falsetruefalsetrue0false
Tools.js(notparsed)falsetruefalsetrue0false
TouchSupport.js(notparsed)falsetruefalsetrue0false
Undo.js(notparsed)falsetruefalsetrue0false
WebPIM.js(notparsed)falsetruefalsetrue0false
Widgets.js(notparsed)falsetruefalsetrue0false
WikiParser.js(notparsed)falsetruefalsetrue0false
WikiParser.ometa(notparsed)falsetruefalsetrue0false
WikiWidget.js(notparsed)falsetruefalsetrue0false238.0000139nullnullnulltruefalsefalsenullnulltruetrue
false00.11truefalse
nullfalse
nullfalse
nullfalse
nullfalsefalsetruetrue
NetRequest(extension)falsetruefalsetrue0false
SpellCheckerfalsetruefalsetrue0false
SpellCheckerLayerfalsetruefalsetrue0false
lively.SpellChecker.SpellCheckerTestfalsetruefalsetrue0false238.00001-1nullnullnulltruefalsefalsenullnulltruetrue
false00.11truefalse
nullfalse
nullfalse
nullfalse
nullfalsefalsetruetrue
-----falsetruefalsetrue0false238.00001
-1nullnullnulltruefalsetruetrue
false00.11truefalse
nullfalse
nullfalse
nullfalse
nullfalsefalsetruetrue
-----falsetruefalsetrue0false238.00001
-1nullnullnulltruefalsetruetrue
false00.11truefalse
nullfalse
nullfalse
nullfalse
nullfalsefalsetruetrue
20nullfalse
module('lively.SpellChecker').requires('lively.Text','cop.Layers','lively.TestFramework').toRun(function(){createLayer("SpellCheckerLayer");//enableLayer(SpellCheckerLayer);//disableLayer(SpellCheckerLayer);createLayer("NetRquestsAreSyncLayer")layerClass(NetRquestsAreSyncLayer,NetRequest,{getisSync(){returntrue;}});Object.subclass("SpellChecker",{querySpellCheckService:function(input){varself=this;varrequest=newNetRequest({model:this,setStatus:"onResponse"});varurl="http://lively-kernel.org/cgi/send_req.pl?lang=en&hl=en"varpost='<?xmlversion="1.0"encoding="utf-8"?>\<spellrequesttextalreadyclipped="0"ignoredups="0"ignoredigits="1"ignoreallcaps="1">\<text>'+input.asString()+'</text>\</spellrequest>';varrequest=request;withLayers([NetRquestsAreSyncLayer],function(){request.post(url,post);})returnrequest.getResponseText()},extractSpellCheck:function(xml){nodes=$A(xml.childNodes[0].childNodes).collect(function(ea){console.log("c.o="+Number(ea.getAttribute("o")));return{offset:Number(ea.getAttribute("o")),length:Number(ea.getAttribute("l")),confidence:Number(ea.getAttribute("s")),suggestions:ea.textContent}})returnnodes},onResponse:function(request){console.log("Igotsomething"+request.getResponseText());}})cop.create('SpellCheckerLayer').refineClass(TextMorph,{correctWithSuggestion:function(proceed,offset,length,suggestion){console.log("correctfrom"+offset+"to"+offset+length+"with:"+suggestion);this.setSelectionRange(offset,offset+length);this.replaceSelectionWith(suggestion);this.emphasizeFromTo({color:null,spellchecksuggestions:null},offset,offset+suggestion.length)},morphMenu:function(proceed,evt){varspellCheck=this.spellCheckUnderMouse(evt);varmenu=proceed(evt);varself=this;if(menu&&spellCheck&&spellCheck.suggestions){varsuggestions=spellCheck.suggestions;menu.addItem(["-----",function(){}],0);console.log("spellCheck:"+suggestions)suggestions.split('').reverse().each(function(ea){menu.addItem([ea,function(){self.correctWithSuggestion(spellCheck.offset,spellCheck.length,ea)}],0);})}menu.addItem(["checkspelling",this.spellCheckAll])returnmenu},spellCheckAll:function(){varchecker=newSpellChecker();varxmlString=checker.querySpellCheckService(this.textString);if(!xmlString){thrownewError('SpellChecking:noresponse')};varself=this;varxml=newDOMParser().parseFromString(xmlString,"text/xml");corrections=checker.extractSpellCheck(xml)corrections.each(function(ea){vara=ea.offset;varb=a+ea.length;console.log("spellCheck="+ea);varstyle={color:"red",spellchecksuggestions:ea.suggestions};self.emphasizeFromTo(style,a,b);console.log("colorfrom"+a+"to"+b)})},spellCheckUnderMouse:function(proceed,evt){if(!this.textStyle)returnnull;varcharIx=this.charOfPoint(this.localize(evt.mousePoint));varstyle=this.textStyle.valueAt(charIx);//wehavetocomputeit,becauseitchanges.....varmark=this.textStyle.markAt(charIx)return{offset:charIx-mark.offset,length:this.textStyle.runs[mark.runIndex]-1,suggestions:style.spellchecksuggestions};},});TestCase.subclass("lively.SpellChecker.SpellCheckerTest",{testQuerySpellCheckService:function(){varself=this;varchecker=newSpellChecker();varexpected='<?xmlversion="1.0"encoding="UTF-8"?><spellresulterror="0"clipped="0"charschecked="13"><co="10"l="3"s="0">textTXext</c></spellresult>'varresult=checker.querySpellCheckService("Thisisatxt");this.assertEqual(result,expected,"wrongxml");},testExtractSuggestions:function(){varchecker=newSpellChecker();varxmlString='<?xmlversion="1.0"encoding="UTF-8"?><spellresulterror="0"clipped="0"charschecked="23"><co="5"l="3"s="1">textTXext</c><co="13"l="3"s="1">twotoeTetoTheo</c></spellresult>';varxml=newDOMParser().parseFromString(xmlString,"text/xml");this.assert(xml,"couldnotparse"+xmlString);varspellChecks=checker.extractSpellCheck(xml);this.assertEqual(spellChecks.length,2,"wrongnumberofspellchecks");this.assert(spellChecks[0].offset,"nooffset");this.assert(spellChecks[0].length,"nolength");this.assert(spellChecks[0].confidence,"noconfidence");this.assert(spellChecks[0].suggestions,"nosuggestions");}});}); \\\n\\\n ' +input.asString() +'\\\n';\n\n\t\tvar request = request;\n\t\twithLayers([NetRquestsAreSyncLayer], function(){\n\t\t\trequest.post( url, post);\n\t\t})\n\n\t\treturn request.getResponseText()\n\t},\n\t\n\textractSpellCheck: function(xml){\n\t\tnodes = $A(xml.childNodes[0].childNodes).collect(function(ea) {\n\t\t\tconsole.log(\"c.o = \" + Number(ea.getAttribute(\"o\")));\n\t\t\treturn {offset: Number(ea.getAttribute(\"o\")), \n\t\t\t\tlength: Number(ea.getAttribute(\"l\")), \n\t\t\t\tconfidence: Number(ea.getAttribute(\"s\")),\n\t\t\t\tsuggestions: ea.textContent}\n\t\t})\n\t\treturn nodes\n\t},\n\n\tonResponse: function(request) {\n\t\tconsole.log(\"I got something\" + request.getResponseText());\n \n\t}\n})\n\n\ncop.create('SpellCheckerLayer')\n.refineClass(TextMorph, {\n\n\tcorrectWithSuggestion: function(proceed, offset, length, suggestion) {\n\t\tconsole.log(\"correct from \" + offset + \" to \" + \n\t\t\toffset + length +\" with: \" + suggestion);\t\t\n\t\tthis.setSelectionRange(offset, offset + length);\n\t\tthis.replaceSelectionWith(suggestion);\n\t\tthis.emphasizeFromTo({color: null, spellchecksuggestions: null }, offset, offset + suggestion.length)\n\t},\n\n\tmorphMenu: function(proceed, evt) {\n\t\tvar spellCheck = this.spellCheckUnderMouse(evt);\n\t\tvar menu = proceed(evt);\n\t\tvar self = this;\n\t\tif (menu && spellCheck && spellCheck.suggestions) {\n\t\t\tvar suggestions = spellCheck.suggestions;\n\t\t\tmenu.addItem([\"-----\", function(){ }], 0 );\n\t\t\tconsole.log(\"spellCheck: \" + suggestions)\n\t\t\tsuggestions.split('\t').reverse().each(function(ea) {\n\t\t\t\tmenu.addItem([ea, function() { \n\t\t\t\t\tself.correctWithSuggestion(spellCheck.offset, spellCheck.length, ea)\n\t\t\t\t}], 0 );\n\t\t\t})\n\t\t}\n\t\tmenu.addItem([\"check spelling\", this.spellCheckAll])\n\t\treturn menu\n\t},\n\n\tspellCheckAll: function() {\n\t\tvar checker = new SpellChecker();\n\t\tvar xmlString = checker.querySpellCheckService(this.textString);\n\t\tif (!xmlString) {\n\t\t\tthrow new Error('Spell Checking: no response')\n\t\t};\n\t\tvar self = this;\n\t\tvar xml = new DOMParser().parseFromString(xmlString, \"text/xml\");\n\t\tcorrections = checker.extractSpellCheck(xml)\n\t\tcorrections.each(function(ea){\n\t\t\tvar a = ea.offset;\n\t\t\tvar b = a + ea.length ;\n\t\t\tconsole.log(\"spellCheck = \" + ea);\n\t\t\tvar style = {color: \"red\",\n\t\t\t\t\tspellchecksuggestions: ea.suggestions };\n\t\t\tself.emphasizeFromTo(style, a, b);\n\t\t\tconsole.log(\"color from \" + a + \" to \" + b)\n\t\t})\n\t},\n\n \n\tspellCheckUnderMouse: function(proceed, evt) {\t \n\t\tif (!this.textStyle) return null;\n\t\tvar charIx = this.charOfPoint(this.localize(evt.mousePoint));\n\t\tvar style = this.textStyle.valueAt(charIx);\n\t\t// we have to compute it, because it changes.....\n\t\tvar mark = this.textStyle.markAt(charIx)\n\t\treturn {\n\t\t\toffset: charIx - mark.offset,\n\t\t\tlength: this.textStyle.runs[mark.runIndex] - 1,\n\t\t\tsuggestions: style.spellchecksuggestions\n\t\t};\t\t \n\t},\n\n});\n\nTestCase.subclass(\"lively.SpellChecker.SpellCheckerTest\", {\n\n\ttestQuerySpellCheckService: function() {\n\n\t\tvar self = this;\n\t\tvar checker = new SpellChecker();\n\t\t\n\t\tvar expected = 'text\tTX\text'\n\t\n\t\tvar result = checker.querySpellCheckService(\"This is a txt\");\n\n\t\tthis.assertEqual(result, expected, \"wrong xml\");\t\n\t},\n\n\ttestExtractSuggestions: function() {\n\n\t\tvar checker = new SpellChecker();\n\t\tvar xmlString = 'text\tTX\texttwo\ttoe\tTe\tto\tTheo';\n\n\t\tvar xml = new DOMParser().parseFromString(xmlString, \"text/xml\");\n\t\tthis.assert(xml, \"could not parse \" + xmlString);\n\t\tvar spellChecks = checker.extractSpellCheck(xml);\n\t\tthis.assertEqual(spellChecks.length, 2, \"wrong number of spellchecks\");\n\t\tthis.assert(spellChecks[0].offset, \" no offset\");\n\t\tthis.assert(spellChecks[0].length, \" no length\");\n\t\tthis.assert(spellChecks[0].confidence, \" no confidence\");\n\t\tthis.assert(spellChecks[0].suggestions, \" no suggestions\");\n\t}\n});\n\n});"]]>147truetrue2000000
falsenull \\\n\\\n ' +input.asString() +'\\\n';\n\n\t\tvar request = request;\n\t\twithLayers([NetRquestsAreSyncLayer], function(){\n\t\t\trequest.post( url, post);\n\t\t})\n\n\t\treturn request.getResponseText()\n\t},\n\t\n\textractSpellCheck: function(xml){\n\t\tnodes = $A(xml.childNodes[0].childNodes).collect(function(ea) {\n\t\t\tconsole.log(\"c.o = \" + Number(ea.getAttribute(\"o\")));\n\t\t\treturn {offset: Number(ea.getAttribute(\"o\")), \n\t\t\t\tlength: Number(ea.getAttribute(\"l\")), \n\t\t\t\tconfidence: Number(ea.getAttribute(\"s\")),\n\t\t\t\tsuggestions: ea.textContent}\n\t\t})\n\t\treturn nodes\n\t},\n\n\tonResponse: function(request) {\n\t\tconsole.log(\"I got something\" + request.getResponseText());\n \n\t}\n})\n\n\ncop.create('SpellCheckerLayer')\n.refineClass(TextMorph, {\n\n\tcorrectWithSuggestion: function(proceed, offset, length, suggestion) {\n\t\tconsole.log(\"correct from \" + offset + \" to \" + \n\t\t\toffset + length +\" with: \" + suggestion);\t\t\n\t\tthis.setSelectionRange(offset, offset + length);\n\t\tthis.replaceSelectionWith(suggestion);\n\t\tthis.emphasizeFromTo({color: null, spellchecksuggestions: null }, offset, offset + suggestion.length)\n\t},\n\n\tmorphMenu: function(proceed, evt) {\n\t\tvar spellCheck = this.spellCheckUnderMouse(evt);\n\t\tvar menu = proceed(evt);\n\t\tvar self = this;\n\t\tif (menu && spellCheck && spellCheck.suggestions) {\n\t\t\tvar suggestions = spellCheck.suggestions;\n\t\t\tmenu.addItem([\"-----\", function(){ }], 0 );\n\t\t\tconsole.log(\"spellCheck: \" + suggestions)\n\t\t\tsuggestions.split('\t').reverse().each(function(ea) {\n\t\t\t\tmenu.addItem([ea, function() { \n\t\t\t\t\tself.correctWithSuggestion(spellCheck.offset, spellCheck.length, ea)\n\t\t\t\t}], 0 );\n\t\t\t})\n\t\t}\n\t\tmenu.addItem([\"check spelling\", this.spellCheckAll])\n\t\treturn menu\n\t},\n\n\tspellCheckAll: function() {\n\t\tvar checker = new SpellChecker();\n\t\tvar xmlString = checker.querySpellCheckService(this.textString);\n\t\tif (!xmlString) {\n\t\t\tthrow new Error('Spell Checking: no response')\n\t\t};\n\t\tvar self = this;\n\t\tvar xml = new DOMParser().parseFromString(xmlString, \"text/xml\");\n\t\tcorrections = checker.extractSpellCheck(xml)\n\t\tcorrections.each(function(ea){\n\t\t\tvar a = ea.offset;\n\t\t\tvar b = a + ea.length ;\n\t\t\tconsole.log(\"spellCheck = \" + ea);\n\t\t\tvar style = {color: \"red\",\n\t\t\t\t\tspellchecksuggestions: ea.suggestions };\n\t\t\tself.emphasizeFromTo(style, a, b);\n\t\t\tconsole.log(\"color from \" + a + \" to \" + b)\n\t\t})\n\t},\n\n \n\tspellCheckUnderMouse: function(proceed, evt) {\t \n\t\tif (!this.textStyle) return null;\n\t\tvar charIx = this.charOfPoint(this.localize(evt.mousePoint));\n\t\tvar style = this.textStyle.valueAt(charIx);\n\t\t// we have to compute it, because it changes.....\n\t\tvar mark = this.textStyle.markAt(charIx)\n\t\treturn {\n\t\t\toffset: charIx - mark.offset,\n\t\t\tlength: this.textStyle.runs[mark.runIndex] - 1,\n\t\t\tsuggestions: style.spellchecksuggestions\n\t\t};\t\t \n\t},\n\n});\n\nTestCase.subclass(\"lively.SpellChecker.SpellCheckerTest\", {\n\n\ttestQuerySpellCheckService: function() {\n\n\t\tvar self = this;\n\t\tvar checker = new SpellChecker();\n\t\t\n\t\tvar expected = 'text\tTX\text'\n\t\n\t\tvar result = checker.querySpellCheckService(\"This is a txt\");\n\n\t\tthis.assertEqual(result, expected, \"wrong xml\");\t\n\t},\n\n\ttestExtractSuggestions: function() {\n\n\t\tvar checker = new SpellChecker();\n\t\tvar xmlString = 'text\tTX\texttwo\ttoe\tTe\tto\tTheo';\n\n\t\tvar xml = new DOMParser().parseFromString(xmlString, \"text/xml\");\n\t\tthis.assert(xml, \"could not parse \" + xmlString);\n\t\tvar spellChecks = checker.extractSpellCheck(xml);\n\t\tthis.assertEqual(spellChecks.length, 2, \"wrong number of spellchecks\");\n\t\tthis.assert(spellChecks[0].offset, \" no offset\");\n\t\tthis.assert(spellChecks[0].length, \" no length\");\n\t\tthis.assert(spellChecks[0].confidence, \" no confidence\");\n\t\tthis.assert(spellChecks[0].suggestions, \" no suggestions\");\n\t}\n});\n\n});"]]>truetrue
false00.11truefalsetruetrue
20nullfalse
truetruefalsetruetrue
false00.11truefalsetruetrue
Addmodulefalsenulltruefalsefalsetrue
Loadallfalsenulltruefalsefalsetrue
LineNofalsenulltruefalsefalsetrue
Refreshfalsenulltruefalsefalsetrue
Evalonfalsenulltruefalsefalsetrue
Sortfalsenulltruefalsefalsetrue
Viewas...falsenulltruefalsefalse
classesfalsenulltruefalsetruetruetrue
functionsfalsenulltruefalsetruetruetrue
objectsfalsenulltruefalsetruetruetrue
truetrue
null \\\n\\\n ' +input.asString() +'\\\n';\n\n\t\tvar request = request;\n\t\twithLayers([NetRquestsAreSyncLayer], function(){\n\t\t\trequest.post( url, post);\n\t\t})\n\n\t\treturn request.getResponseText()\n\t},\n\t\n\textractSpellCheck: function(xml){\n\t\tnodes = $A(xml.childNodes[0].childNodes).collect(function(ea) {\n\t\t\tconsole.log(\"c.o = \" + Number(ea.getAttribute(\"o\")));\n\t\t\treturn {offset: Number(ea.getAttribute(\"o\")), \n\t\t\t\tlength: Number(ea.getAttribute(\"l\")), \n\t\t\t\tconfidence: Number(ea.getAttribute(\"s\")),\n\t\t\t\tsuggestions: ea.textContent}\n\t\t})\n\t\treturn nodes\n\t},\n\n\tonResponse: function(request) {\n\t\tconsole.log(\"I got something\" + request.getResponseText());\n \n\t}\n})\n\n\ncop.create('SpellCheckerLayer')\n.refineClass(TextMorph, {\n\n\tcorrectWithSuggestion: function(proceed, offset, length, suggestion) {\n\t\tconsole.log(\"correct from \" + offset + \" to \" + \n\t\t\toffset + length +\" with: \" + suggestion);\t\t\n\t\tthis.setSelectionRange(offset, offset + length);\n\t\tthis.replaceSelectionWith(suggestion);\n\t\tthis.emphasizeFromTo({color: null, spellchecksuggestions: null }, offset, offset + suggestion.length)\n\t},\n\n\tmorphMenu: function(proceed, evt) {\n\t\tvar spellCheck = this.spellCheckUnderMouse(evt);\n\t\tvar menu = proceed(evt);\n\t\tvar self = this;\n\t\tif (menu && spellCheck && spellCheck.suggestions) {\n\t\t\tvar suggestions = spellCheck.suggestions;\n\t\t\tmenu.addItem([\"-----\", function(){ }], 0 );\n\t\t\tconsole.log(\"spellCheck: \" + suggestions)\n\t\t\tsuggestions.split('\t').reverse().each(function(ea) {\n\t\t\t\tmenu.addItem([ea, function() { \n\t\t\t\t\tself.correctWithSuggestion(spellCheck.offset, spellCheck.length, ea)\n\t\t\t\t}], 0 );\n\t\t\t})\n\t\t}\n\t\tmenu.addItem([\"check spelling\", this.spellCheckAll])\n\t\treturn menu\n\t},\n\n\tspellCheckAll: function() {\n\t\tvar checker = new SpellChecker();\n\t\tvar xmlString = checker.querySpellCheckService(this.textString);\n\t\tif (!xmlString) {\n\t\t\tthrow new Error('Spell Checking: no response')\n\t\t};\n\t\tvar self = this;\n\t\tvar xml = new DOMParser().parseFromString(xmlString, \"text/xml\");\n\t\tcorrections = checker.extractSpellCheck(xml)\n\t\tcorrections.each(function(ea){\n\t\t\tvar a = ea.offset;\n\t\t\tvar b = a + ea.length ;\n\t\t\tconsole.log(\"spellCheck = \" + ea);\n\t\t\tvar style = {color: \"red\",\n\t\t\t\t\tspellchecksuggestions: ea.suggestions };\n\t\t\tself.emphasizeFromTo(style, a, b);\n\t\t\tconsole.log(\"color from \" + a + \" to \" + b)\n\t\t})\n\t},\n\n \n\tspellCheckUnderMouse: function(proceed, evt) {\t \n\t\tif (!this.textStyle) return null;\n\t\tvar charIx = this.charOfPoint(this.localize(evt.mousePoint));\n\t\tvar style = this.textStyle.valueAt(charIx);\n\t\t// we have to compute it, because it changes.....\n\t\tvar mark = this.textStyle.markAt(charIx)\n\t\treturn {\n\t\t\toffset: charIx - mark.offset,\n\t\t\tlength: this.textStyle.runs[mark.runIndex] - 1,\n\t\t\tsuggestions: style.spellchecksuggestions\n\t\t};\t\t \n\t},\n\n});\n\nTestCase.subclass(\"lively.SpellChecker.SpellCheckerTest\", {\n\n\ttestQuerySpellCheckService: function() {\n\n\t\tvar self = this;\n\t\tvar checker = new SpellChecker();\n\t\t\n\t\tvar expected = 'text\tTX\text'\n\t\n\t\tvar result = checker.querySpellCheckService(\"This is a txt\");\n\n\t\tthis.assertEqual(result, expected, \"wrong xml\");\t\n\t},\n\n\ttestExtractSuggestions: function() {\n\n\t\tvar checker = new SpellChecker();\n\t\tvar xmlString = 'text\tTX\texttwo\ttoe\tTe\tto\tTheo';\n\n\t\tvar xml = new DOMParser().parseFromString(xmlString, \"text/xml\");\n\t\tthis.assert(xml, \"could not parse \" + xmlString);\n\t\tvar spellChecks = checker.extractSpellCheck(xml);\n\t\tthis.assertEqual(spellChecks.length, 2, \"wrong number of spellchecks\");\n\t\tthis.assert(spellChecks[0].offset, \" no offset\");\n\t\tthis.assert(spellChecks[0].length, \" no length\");\n\t\tthis.assert(spellChecks[0].confidence, \" no confidence\");\n\t\tthis.assert(spellChecks[0].suggestions, \" no suggestions\");\n\t}\n});\n\n});"]]>nullnull
nullfalsetruenull
SpellChecker.jsfalsenulltruefalse
false
false
falsenullfalsefalsenullnullnullnullfalse
nullfalsetruenull
TestRunnerfalsenulltruefalse
false
false
falsenullfalse
TabCompletionLayerTestfalsetruefalsetrue0false
TabCompletionTestfalsetruefalsetrue0false600
-1nullnullnulltrue0truetrue
00.11truetruetrue
RunTestCasefalsenulltruefalsetrue
RunAllTestCasesfalsenulltruefalsetrue
Refreshfalsenulltruefalsetrue
null
null0
-----falsetruefalsetrue0600
-1nullnulltruetruetrue
00.11truetruetrue
truefalsenullnullnullnullfalse
<?xmlversion="1.0"encoding="UTF-8"?><spellresulterror="0"clipped="0"charschecked="23"><co="5"l="3"s="1">textTXext</c><co="13"l="3"s="1">twotoeTetoTheo</c></spellresult>text\tTX\texttwo\ttoe\tTe\tto\tTheo"]]>4
Thistxthasteoerrors
Helloworldwhatareyoudoingg
null66