Getting all the unit tests working again with the GUID to alias change, lots of little fixes everywhere.

This commit is contained in:
Shannon
2013-09-06 17:50:31 +10:00
parent cf6a3cdfef
commit b3ec44b61d
41 changed files with 133 additions and 491 deletions

View File

@@ -3,7 +3,7 @@ using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.UI.App_Plugins.MyPackage.PropertyEditors
{
[PropertyEditor("E96E24E5-7124-4FA8-A7D7-C3D3695E100D", "Postal Code",
[PropertyEditor("MyPackage.PostalCode", "Postal Code",
"~/App_Plugins/MyPackage/PropertyEditors/Views/PostcodeEditor.html")]
public class PostcodePropertyEditor : PropertyEditor
{

View File

@@ -8,7 +8,7 @@ using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.UI.App_Plugins.MyPackage.PropertyEditors
{
[PropertyEditor("AD056473-492B-47F8-9613-5A4936666C67", "Server Info")]
[PropertyEditor("MyPackage.ServerInfo", "Server Info")]
public class ServerInfoPropertyEditor : PropertyEditor
{
//cache the URL since these values get called numerous times.

View File

@@ -879,13 +879,6 @@
<Content Include="Umbraco_Client\CodeMirror\Js\Mode\Xml\index.html" />
<Content Include="Umbraco_Client\CodeMirror\Js\Mode\Xml\xml.js" />
<Content Include="Umbraco_Client\CodeMirror\Js\Mode\Xquery\index.html" />
<Content Include="Umbraco_Client\CodeMirror\Js\Mode\Xquery\Test\index.html" />
<Content Include="Umbraco_Client\CodeMirror\Js\Mode\Xquery\Test\testBase.js" />
<Content Include="Umbraco_Client\CodeMirror\Js\Mode\Xquery\Test\testEmptySequenceKeyword.js" />
<Content Include="Umbraco_Client\CodeMirror\Js\Mode\Xquery\Test\testMultiAttr.js" />
<Content Include="Umbraco_Client\CodeMirror\Js\Mode\Xquery\Test\testNamespaces.js" />
<Content Include="Umbraco_Client\CodeMirror\Js\Mode\Xquery\Test\testProcessingInstructions.js" />
<Content Include="Umbraco_Client\CodeMirror\Js\Mode\Xquery\Test\testQuotes.js" />
<Content Include="Umbraco_Client\CodeMirror\Js\Mode\Xquery\xquery.js" />
<Content Include="Umbraco_Client\CodeMirror\Js\Mode\Yaml\index.html" />
<Content Include="Umbraco_Client\CodeMirror\Js\Mode\Yaml\yaml.js" />

View File

@@ -1,27 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css" type="text/css"/>
<script src="http://code.jquery.com/jquery-latest.js"> </script>
<script type="text/javascript" src="http://code.jquery.com/qunit/qunit-git.js"></script>
<script src="../../../lib/codemirror.js"></script>
<script src="../xquery.js"></script>
<script type="text/javascript" src="testBase.js"></script>
<script type="text/javascript" src="testMultiAttr.js"></script>
<script type="text/javascript" src="testQuotes.js"></script>
<script type="text/javascript" src="testEmptySequenceKeyword.js"></script>
<script type="text/javascript" src="testProcessingInstructions.js"></script>
<script type="text/javascript" src="testNamespaces.js"></script>
</head>
<body>
<h1 id="qunit-header">XQuery CodeMirror Mode</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests">
</ol>
<div id="sandbox" style="right:5000px; position:absolute; "></div>
</body>
</html>

View File

@@ -1,42 +0,0 @@
$(document).ready(function(){
module("testBase");
test("eviltest", function() {
expect(1);
var input = 'xquery version &quot;1.0-ml&quot;;\
(: this is\
: a \
"comment" :)\
let $let := &lt;x attr=&quot;value&quot;&gt;&quot;test&quot;&lt;func&gt;function() $var {function()} {$var}&lt;/func&gt;&lt;/x&gt;\
let $joe:=1\
return element element {\
attribute attribute { 1 },\
element test { &#39;a&#39; }, \
attribute foo { &quot;bar&quot; },\
fn:doc()[ foo/@bar eq $let ],\
//x } \
\
(: a more \'evil\' test :)\
(: Modified Blakeley example (: with nested comment :) ... :)\
declare private function local:declare() {()};\
declare private function local:private() {()};\
declare private function local:function() {()};\
declare private function local:local() {()};\
let $let := &lt;let&gt;let $let := &quot;let&quot;&lt;/let&gt;\
return element element {\
attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } },\
attribute fn:doc { &quot;bar&quot; castable as xs:string },\
element text { text { &quot;text&quot; } },\
fn:doc()[ child::eq/(@bar | attribute::attribute) eq $let ],\
//fn:doc\
}';
var expected = '<span class="cm-keyword">xquery</span> <span class="cm-keyword">version</span> <span class="cm-string">"1.0-ml"</span><span class="cm-variable cm-def">;</span> <span class="cm-comment">(: this is : a "comment" :)</span> <span class="cm-keyword">let</span> <span class="cm-variable">$let</span> <span class="cm-keyword">:=</span> <span class="cm-tag">&lt;x </span><span class="cm-attribute">attr</span>=<span class="cm-string">"value"</span><span class="cm-tag">&gt;</span><span class="cm-word">"test"</span><span class="cm-tag">&lt;func&gt;</span><span class="cm-word">function()</span> <span class="cm-word">$var</span> {<span class="cm-keyword">function</span>()} {<span class="cm-variable">$var</span>}<span class="cm-tag">&lt;/func&gt;&lt;/x&gt;</span> <span class="cm-keyword">let</span> <span class="cm-variable">$joe</span><span class="cm-keyword">:=</span><span class="cm-atom">1</span> <span class="cm-keyword">return</span> <span class="cm-keyword">element</span> <span class="cm-word">element</span> { <span class="cm-keyword">attribute</span> <span class="cm-word">attribute</span> { <span class="cm-atom">1</span> }, <span class="cm-keyword">element</span> <span class="cm-word">test</span> { <span class="cm-string">\'a\'</span> }, <span class="cm-keyword">attribute</span> <span class="cm-word">foo</span> { <span class="cm-string">"bar"</span> }, <span class="cm-variable cm-def">fn:doc</span>()[ <span class="cm-word">foo</span><span class="cm-keyword">/</span><span class="cm-word">@bar</span> <span class="cm-keyword">eq</span> <span class="cm-variable">$let</span> ], <span class="cm-keyword">//</span><span class="cm-word">x</span> } <span class="cm-comment">(: a more \'evil\' test :)</span> <span class="cm-comment">(: Modified Blakeley example (: with nested comment :) ... :)</span> <span class="cm-keyword">declare</span> <span class="cm-keyword">private</span> <span class="cm-keyword">function</span> <span class="cm-variable cm-def">local:declare</span>() {()}<span class="cm-word">;</span> <span class="cm-keyword">declare</span> <span class="cm-keyword">private</span> <span class="cm-keyword">function</span> <span class="cm-variable cm-def">local:private</span>() {()}<span class="cm-word">;</span> <span class="cm-keyword">declare</span> <span class="cm-keyword">private</span> <span class="cm-keyword">function</span> <span class="cm-variable cm-def">local:function</span>() {()}<span class="cm-word">;</span> <span class="cm-keyword">declare</span> <span class="cm-keyword">private</span> <span class="cm-keyword">function</span> <span class="cm-variable cm-def">local:local</span>() {()}<span class="cm-word">;</span> <span class="cm-keyword">let</span> <span class="cm-variable">$let</span> <span class="cm-keyword">:=</span> <span class="cm-tag">&lt;let&gt;</span><span class="cm-word">let</span> <span class="cm-word">$let</span> <span class="cm-word">:=</span> <span class="cm-word">"let"</span><span class="cm-tag">&lt;/let&gt;</span> <span class="cm-keyword">return</span> <span class="cm-keyword">element</span> <span class="cm-word">element</span> { <span class="cm-keyword">attribute</span> <span class="cm-word">attribute</span> { <span class="cm-keyword">try</span> { <span class="cm-variable cm-def">xdmp:version</span>() } <span class="cm-keyword">catch</span>(<span class="cm-variable">$e</span>) { <span class="cm-variable cm-def">xdmp:log</span>(<span class="cm-variable">$e</span>) } }, <span class="cm-keyword">attribute</span> <span class="cm-word">fn:doc</span> { <span class="cm-string">"bar"</span> <span class="cm-word">castable</span> <span class="cm-keyword">as</span> <span class="cm-atom">xs:string</span> }, <span class="cm-keyword">element</span> <span class="cm-word">text</span> { <span class="cm-keyword">text</span> { <span class="cm-string">"text"</span> } }, <span class="cm-variable cm-def">fn:doc</span>()[ <span class="cm-qualifier">child::</span><span class="cm-word">eq</span><span class="cm-keyword">/</span>(<span class="cm-word">@bar</span> <span class="cm-keyword">|</span> <span class="cm-qualifier">attribute::</span><span class="cm-word">attribute</span>) <span class="cm-keyword">eq</span> <span class="cm-variable">$let</span> ], <span class="cm-keyword">//</span><span class="cm-word">fn:doc</span> }';
$("#sandbox").html('<textarea id="editor">' + input + '</textarea>');
var editor = CodeMirror.fromTextArea($("#editor")[0]);
var result = $(".CodeMirror-lines div div pre")[0].innerHTML;
equal(result, expected);
$("#editor").html("");
});
});

View File

@@ -1,16 +0,0 @@
$(document).ready(function(){
module("testEmptySequenceKeyword");
test("testEmptySequenceKeyword", function() {
expect(1);
var input = '"foo" instance of empty-sequence()';
var expected = '<span class="cm-string">"foo"</span> <span class="cm-keyword">instance</span> <span class="cm-keyword">of</span> <span class="cm-keyword">empty-sequence</span>()';
$("#sandbox").html('<textarea id="editor">' + input + '</textarea>');
var editor = CodeMirror.fromTextArea($("#editor")[0]);
var result = $(".CodeMirror-lines div div pre")[0].innerHTML;
equal(result, expected);
$("#editor").html("");
});
});

View File

@@ -1,16 +0,0 @@
$(document).ready(function(){
module("testMultiAttr");
test("test1", function() {
expect(1);
var expected = '<span class="cm-tag">&lt;p </span><span class="cm-attribute">a1</span>=<span class="cm-string">"foo"</span> <span class="cm-attribute">a2</span>=<span class="cm-string">"bar"</span><span class="cm-tag">&gt;</span><span class="cm-word">hello</span> <span class="cm-word">world</span><span class="cm-tag">&lt;/p&gt;</span>';
$("#sandbox").html('<textarea id="editor"></textarea>');
$("#editor").html('<p a1="foo" a2="bar">hello world</p>');
var editor = CodeMirror.fromTextArea($("#editor")[0]);
var result = $(".CodeMirror-lines div div pre")[0].innerHTML;
equal(result, expected);
$("#editor").html("");
});
});

View File

@@ -1,91 +0,0 @@
$(document).ready(function(){
module("test namespaces");
// --------------------------------------------------------------------------------
// this test is based on this:
//http://mbrevoort.github.com/CodeMirror2/#!exprSeqTypes/PrologExpr/VariableProlog/ExternalVariablesWith/K2-ExternalVariablesWith-10.xq
// --------------------------------------------------------------------------------
test("test namespaced variable", function() {
expect(1);
var input = 'declare namespace e = "http://example.com/ANamespace";\
declare variable $e:exampleComThisVarIsNotRecognized as element(*) external;';
var expected = '<span class="cm-keyword">declare</span> <span class="cm-keyword">namespace</span> <span class="cm-word">e</span> <span class="cm-keyword">=</span> <span class="cm-string">"http://example.com/ANamespace"</span><span class="cm-word">;declare</span> <span class="cm-keyword">variable</span> <span class="cm-variable">$e:exampleComThisVarIsNotRecognized</span> <span class="cm-keyword">as</span> <span class="cm-keyword">element</span>(<span class="cm-keyword">*</span>) <span class="cm-word">external;</span>';
$("#sandbox").html('<textarea id="editor">' + input + '</textarea>');
var editor = CodeMirror.fromTextArea($("#editor")[0]);
var result = $(".CodeMirror-lines div div pre")[0].innerHTML;
equal(result, expected);
$("#editor").html("");
});
// --------------------------------------------------------------------------------
// this test is based on:
// http://mbrevoort.github.com/CodeMirror2/#!Basics/EQNames/eqname-002.xq
// --------------------------------------------------------------------------------
test("test EQName variable", function() {
expect(1);
var input = 'declare variable $"http://www.example.com/ns/my":var := 12;\
<out>{$"http://www.example.com/ns/my":var}</out>';
var expected = '<span class="cm-keyword">declare</span> <span class="cm-keyword">variable</span> <span class="cm-variable">$"http://www.example.com/ns/my":var</span> <span class="cm-keyword">:=</span> <span class="cm-atom">12</span><span class="cm-word">;</span><span class="cm-tag">&lt;out&gt;</span>{<span class="cm-variable">$"http://www.example.com/ns/my":var</span>}<span class="cm-tag">&lt;/out&gt;</span>';
$("#sandbox").html('<textarea id="editor">' + input + '</textarea>');
var editor = CodeMirror.fromTextArea($("#editor")[0]);
var result = $(".CodeMirror-lines div div pre")[0].innerHTML;
equal(result, expected);
$("#editor").html("");
});
// --------------------------------------------------------------------------------
// this test is based on:
// http://mbrevoort.github.com/CodeMirror2/#!Basics/EQNames/eqname-003.xq
// --------------------------------------------------------------------------------
test("test EQName function", function() {
expect(1);
var input = 'declare function "http://www.example.com/ns/my":fn ($a as xs:integer) as xs:integer {\
$a + 2\
};\
<out>{"http://www.example.com/ns/my":fn(12)}</out>';
var expected = '<span class="cm-keyword">declare</span> <span class="cm-keyword">function</span> <span class="cm-variable cm-def">"http://www.example.com/ns/my":fn</span> (<span class="cm-variable">$a</span> <span class="cm-keyword">as</span> <span class="cm-atom">xs:integer</span>) <span class="cm-keyword">as</span> <span class="cm-atom">xs:integer</span> { <span class="cm-variable">$a</span> <span class="cm-keyword">+</span> <span class="cm-atom">2</span>}<span class="cm-word">;</span><span class="cm-tag">&lt;out&gt;</span>{<span class="cm-variable cm-def">"http://www.example.com/ns/my":fn</span>(<span class="cm-atom">12</span>)}<span class="cm-tag">&lt;/out&gt;</span>';
$("#sandbox").html('<textarea id="editor">' + input + '</textarea>');
var editor = CodeMirror.fromTextArea($("#editor")[0]);
var result = $(".CodeMirror-lines div div pre")[0].innerHTML;
equal(result, expected);
$("#editor").html("");
});
// --------------------------------------------------------------------------------
// this test is based on:
// http://mbrevoort.github.com/CodeMirror2/#!Basics/EQNames/eqname-003.xq
// --------------------------------------------------------------------------------
test("test EQName function with single quotes", function() {
expect(1);
var input = 'declare function \'http://www.example.com/ns/my\':fn ($a as xs:integer) as xs:integer {\
$a + 2\
};\
<out>{\'http://www.example.com/ns/my\':fn(12)}</out>';
var expected = '<span class="cm-keyword">declare</span> <span class="cm-keyword">function</span> <span class="cm-variable cm-def">\'http://www.example.com/ns/my\':fn</span> (<span class="cm-variable">$a</span> <span class="cm-keyword">as</span> <span class="cm-atom">xs:integer</span>) <span class="cm-keyword">as</span> <span class="cm-atom">xs:integer</span> { <span class="cm-variable">$a</span> <span class="cm-keyword">+</span> <span class="cm-atom">2</span>}<span class="cm-word">;</span><span class="cm-tag">&lt;out&gt;</span>{<span class="cm-variable cm-def">\'http://www.example.com/ns/my\':fn</span>(<span class="cm-atom">12</span>)}<span class="cm-tag">&lt;/out&gt;</span>';
$("#sandbox").html('<textarea id="editor">' + input + '</textarea>');
var editor = CodeMirror.fromTextArea($("#editor")[0]);
var result = $(".CodeMirror-lines div div pre")[0].innerHTML;
equal(result, expected);
$("#editor").html("");
});
});

View File

@@ -1,16 +0,0 @@
$(document).ready(function(){
module("testProcessingInstructions");
test("testProcessingInstructions", function() {
expect(1);
var input = 'data(<?target content?>) instance of xs:string';
var expected = '<span class="cm-variable cm-def">data</span>(<span class="cm-comment cm-meta">&lt;?target content?&gt;</span>) <span class="cm-keyword">instance</span> <span class="cm-keyword">of</span> <span class="cm-atom">xs:string</span>';
$("#sandbox").html('<textarea id="editor">' + input + '</textarea>');
var editor = CodeMirror.fromTextArea($("#editor")[0]);
var result = $(".CodeMirror-lines div div pre")[0].innerHTML;
equal(result, expected);
$("#editor").html("");
});
});

View File

@@ -1,19 +0,0 @@
$(document).ready(function(){
module("testQuoteEscape");
test("testQuoteEscapeDouble", function() {
expect(1);
var input = 'let $rootfolder := "c:\\builds\\winnt\\HEAD\\qa\\scripts\\"\
let $keysfolder := concat($rootfolder, "keys\\")\
return\
$keysfolder';
var expected = '<span class="cm-keyword">let</span> <span class="cm-variable">$rootfolder</span> <span class="cm-keyword">:=</span> <span class="cm-string">"c:\\builds\\winnt\\HEAD\\qa\\scripts\\"</span><span class="cm-keyword">let</span> <span class="cm-variable">$keysfolder</span> <span class="cm-keyword">:=</span> <span class="cm-variable cm-def">concat</span>(<span class="cm-variable">$rootfolder</span>, <span class="cm-string">"keys\\"</span>)<span class="cm-word">return$keysfolder</span>';
$("#sandbox").html('<textarea id="editor">' + input + '</textarea>');
var editor = CodeMirror.fromTextArea($("#editor")[0]);
var result = $(".CodeMirror-lines div div pre")[0].innerHTML;
equal(result, expected);
$("#editor").html("");
});
});