parser.html 41.7 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164
<!DOCTYPE html>
<html>
	<head>
		<title>Parser Unit Test</title>
		<style type="text/css">
			@import "../../resources/dojo.css";
		</style>
		<script type="text/javascript" src="../../dojo.js" data-dojo-config="isDebug:true, async:true"></script>
		<script type="text/javascript">
		var MyNonDojoClass = function() {};
		MyNonDojoClass.extend = function(){
			var args = arguments;
			return function() {
				this.expectedClass = true;
				this.params = args;
			};
		};

		require([
			"require", "dojo/_base/array", "dojo/aspect", "dojo/_base/declare",
			"dojo/dom", "dojo/dom-attr", "dojo/dom-construct", "dojo/_base/lang", "dojo/on", "dojo/parser",
			"dojo/_base/window", "dojo/date/stamp", "dojo/Stateful", "dojo/Evented",
			"doh", "dojo/tests/resources/AMDWidget", "dojo/tests/resources/AMDMixin", "dojo/domReady!"
		], function(require, array, aspect, declare, dom, domAttr, domConstruct, lang, on, parser, win, dstamp,
						Stateful, Evented, doh, AMDWidget, AMDMixin){

			declare("tests.parser.Widget", null, {
				constructor: function(args, node){
					this.params = args;
				}
			});

			declare("tests.parser.Class1", null, {
				constructor: function(args, node){
					this.params = args;
					lang.mixin(this, args);
				},
				preambleTestProp: 1,
				preamble: function(){
					this.preambleTestProp++;
				},
				intProp: 1,
				callCount: 0, // for connect testing
				callInc: function(){ this.callCount++; },
				callCount2: 0, // for assignment testing
				strProp1: "original1",
				strProp2: "original2",
				arrProp: [],
				arrProp2: ["foo"],
				boolProp1: false,
				boolProp2: true,
				boolProp3: false,
				boolProp4: true,
				dateProp1: dstamp.fromISOString('2007-01-01'),
				dateProp2: dstamp.fromISOString('2007-01-01'),
				dateProp3: dstamp.fromISOString('2007-01-01'),
				funcProp: function(){},
				funcProp2: function(){},
				funcProp3: function(){},
				onclick: function(){ this.prototypeOnclick=true; }
				// FIXME: have to test dates!!
				// FIXME: need to test the args property!!
			});

			declare("tests.parser.Class2", null, {
				constructor: function(){
					this.fromMarkup = false;
				},
				fromMarkup: false,
				markupFactory: function(args, node, classCtor){
					var i = new tests.parser.Class2();
					i.fromMarkup = true;
					return i;
				}
			});

			declare("tests.parser.Class3", tests.parser.Class2, {
				fromMarkup: false,
				markupFactory: function(args, node, classCtor){
					var i = new classCtor();
					i.classCtor = classCtor;
					i.params = args;
					return i;
				}
			});

			declare("tests.parser.InputClass", null, {
				constructor: function(args, node){
					this.params = args;
					lang.mixin(this, args);
				},

				// these attributes are special in HTML, they don't have a value specified
				disabled: false,
				readonly: false,
				checked: false,

				// other attributes native to HTML
				value: "default value",
				title: "default title",
				tabIndex: "0",		// special because mixed case

				// custom widget attributes that don't match a native HTML attributes
				custom1: 123,
				custom2: 456
			});

			// Test that dir, lang, etc. attributes can be inherited from ancestor node
			declare("tests.parser.BidiClass", tests.parser.Widget, {
				constructor: function(args, node){ lang.mixin(this, args); },
				dir: "",
				lang: "",
				textdir: "",
				name: ""
			});

			// For testing that parser recurses correctly, except when the prototype has a
			// stopParser flag
			declare("tests.parser.NormalContainer", null, {
				constructor: function(args, node){ lang.mixin(this, args); }
			});
			declare("tests.parser.ShieldedContainer", null, {
				constructor: function(args, node){ lang.mixin(this, args); },

				// flag to tell parser not to instantiate nodes inside of me
				stopParser: true
			});

			declare("tests.parser.HTML5Props", null, {
				constructor: function(args, node){ lang.mixin(this, args); },
				simple:false,
				a:2,
				b:null, c:null, d: null, e:null, f:null,
				afn: function(){
					return this.a * 2;
				}
			});

			// not on .prototype:
			tests.parser.HTML5Props._aDefaultObj = {
				a:1, b:2, simple:true
			};

			declare("tests.parser.HTML5withMethod", null, {
				constructor: function(args, node){ lang.mixin(this, args); },
				baseValue: 10,
				someMethod: function(a, b){
					return this.baseValue;
				},
				diffMethod: function(a){
					this._ran = true;
				}
			});

			declare("tests.parser.StatefulClass", [Evented, Stateful], {
				strProp1: "",
				objProp1: {},
				boolProp1: false,
				prototypeOnclick: false,
				onclick: function() {this.prototypeOnclick=true;}
			});

			declare("tests.parser.MethodClass", null, {
				method1ran: false,
				method1after: false,
				method2ran: false,
				method2before: false,
				method2after: false,
				method3result: "",
				method4ran: false,
				method4after: false,
				method1: function() { this.method1ran = true },
				method2: function() { this.method2ran = true },
				method3: function(result) { this.method3result = result; },
				method4: function() { this.method4ran = true }
			});

			declare("tests.parser.ClassForMixins", null, {
				classDone: true
			});

			declare("tests.parser.Mixin1", null, {
				mixin1Done: true
			});

			declare("tests.parser.Mixin2", null, {
				mixin2Done: true
			});

			deepTestProp = {
				blah: {
					thinger: 1
				}
			};

			tests.parser.FormClass = declare(tests.parser.Widget, {
				encType: ""
			});

			doh.register("basic tests", [
				function parse(){
					// Running the parser here so that failures appear in test log
					parser.parse(dom.byId("main"));
				},
				function testDataDojoId(t){
					t.is("object", typeof obj);
				},
				function testJsId(t){
					// Back-compat test, remove for 2.0
					t.is("object", typeof obj3);
				},
				// Attribute parsing tests
				function testStrProp(t){
					// normal string parameter
					t.t(typeof obj.strProp1 == "string", "obj.strProp1 is string");
					t.is("text", obj.strProp1);

					// make sure that you override a string value like "foo" to a blank value
					t.t(typeof obj.strProp2 == "string", "obj.strProp2 is string");
					t.is("", obj.strProp2);
				},
				function testIntProp(t){
					t.is("number", (typeof obj.intProp));
					t.is(5, obj.intProp);
				},
				function testArrProp(t){
					t.is(3, obj.arrProp.length);
					t.is(3, obj.arrProp[1].length);
					t.is(["foo", "bar", "baz"], obj.arrProp);

					// make sure empty arrays are possible
					t.is([], obj.arrProp2);
				},
				function testBoolProp(t){
					// make sure that both true and false get read correctly,
					// and that unspecified attributes' values don't change

					// boolProp1 specified at true
					t.is("boolean", (typeof obj.boolProp1));
					t.t(obj.boolProp1);

					// boolProp2 specified as false
					t.is("boolean", (typeof obj.boolProp2));
					t.f(obj.boolProp2);

					// boolProp3 not specified (prototype says false)
					t.is("boolean", (typeof obj.boolProp3));
					t.f(obj.boolProp3);

					// boolProp4 not specified (prototype says true)
					t.is("boolean", (typeof obj.boolProp4));
					t.t(obj.boolProp4);
				},
				function testDateProp(t){
					// dateProp1 specified as 2006-1-1
					t.is("2006-01-01", dstamp.toISOString(obj.dateProp1, {selector: 'date'}));

					// dateProp2="", should map to NaN (a blank value on DateTextBox)
					t.t(isNaN(obj.dateProp2));

					// dateProp3="now", should map to current date
					t.is(dstamp.toISOString(new Date(), {selector: 'date'}),
						dstamp.toISOString(obj.dateProp3, {selector: 'date'}));
				},
				function testUnwantedParams(t){
					// Make sure that parser doesn't pass any unwanted parameters to
					// widget constructor, especially "toString" or "constructor".
					// Make exception for dir/lang which parser gleans from document itself.
					for(var param in obj.params){
						doh.t(array.indexOf(
							["strProp1", "strProp2",
								"intProp",
								"arrProp", "arrProp2",
								"boolProp1", "boolProp2",
								"dateProp1", "dateProp2", "dateProp3",
								"funcProp2", "funcProp3",
								"preamble",
								"callInc1", "callInc2", "dir", "lang", "textDir"],
							param) >= 0, param);
					}
				},
				function testDisabledFlag(t){
					t.is("boolean", typeof disabledObj.disabled, "typeof disabled");
					t.t(disabledObj.disabled, "disabled");
					t.f(disabledObj.checked, "checked");
				},
				function testCheckedFlag(t){
					t.is("boolean", typeof checkedObj.checked, "typeof checked");
					t.f(checkedObj.disabled, "disabled");
					t.t(checkedObj.checked, "checked");
				},
				function testFunctionProp(t){
					// make sure that unspecified functions (even with common names)
					// don't get overridden (bug #3074)
					obj.onclick();
					t.t(obj.prototypeOnclick, "prototypeOnClick");

					// funcProp2="foo"
					obj.funcProp2();
					t.t(obj.fooCalled, "fooCalled");

					// funcProp3="this.func3Called=true;"
					obj.funcProp3();
					t.t(obj.func3Called, "func3Called");
				},

				// test script tags inside innerHTML of source node
				"t.is(4, obj.preambleTestProp);",
				"t.is(deepTestProp, obj.deepProp);",
				function testConnect(t){
					obj.callInc();
					t.is(2, obj.callCount);
				},
				function testFunctionAssignment(t){
					obj.callInc2();
					t.is(1, obj.callCount2);
				},
				function testSubNodeParse(t){
					t.f(lang.exists("obj2"), "exists before parse");
					var toParse = dom.byId("toParse");
					parser.parse(toParse.parentNode);
					t.t(lang.exists("obj2"), "exists after parse");
					t.is("tests.parser.Class1", obj2.declaredClass);
				},
				function testMarkupFactory(t){
					t.t(lang.exists("obj3"), "obj3 exists");
					t.t(obj3.fromMarkup);
				},
				function testMarkupFactoryClass(t){
					t.t(lang.exists("obj4"), "obj4 exists");
					t.is(obj4.classCtor, tests.parser.Class3);
					t.t(obj4 instanceof tests.parser.Class3);
					t.t(obj4 instanceof tests.parser.Class2);
				},
				function testnostart(t){

					var started = false;
					declare("SampleThinger", null, {
						startup: function(){
							started = true;
						}
					});

					domConstruct.create("div", { dojoType:"SampleThinger" }, "parsertest");
					parser.parse("parsertest", { noStart:true });

					t.f(started, "first started check");

					domConstruct.empty("parsertest");

					started = false;

					domConstruct.create("div", { dojoType:"SampleThinger" }, "parsertest");
					parser.parse({ noStart:true, rootNode:"parsertest" });

					t.f(started, "second started check");
				},

				// test the various iterations of parser test
				function rootTest(t){

					var tmp = aspect.after(dojo, "query", function(sel, root){
						t.is("parsertest2", root);
					});

					parser.parse("parsertest2");
					parser.parse({ rootNode: "parsertest2" });
					parser.parse("parsertest2", { noStart:true });

					tmp.remove();
				},

				// Test that when BorderContainer etc. extends _Widget,
				// parser is aware of the new parameters added (to _Widget
				// and all of it's subclasses)
				function cacheRefresh(t){
					// Add new node to be parsed, referencing a widget that the parser has already
					// dealt with (and thus cached)
					var wrapper = domConstruct.place("<div><div dojoType='tests.parser.Class3' newParam=12345>hi</div></div>", win.body(), "last");

					// Modify Class3's superclass widget to have new parameter (thus Class3 inherits it)
					lang.extend(tests.parser.Class2, {
						newParam: 0
					});

					// Run the parser and see if it reads in newParam
					var widgets = parser.parse({rootNode: wrapper});
					doh.is(1, widgets.length, "parsed newly inserted parserTest widget");
					doh.is(12345, widgets[0].params.newParam, "new parameter parsed");
				},

				// Test that parser recurses correctly, except when there's a stopParser flag not to
				function recurse(){
					doh.t(container1, "normal container created");
					doh.t(container1.incr, "script tag works too");
					doh.t(window.contained1, "child widget also created");
					doh.t(window.contained2, "child widget 2 also created");

					doh.t(container2, "shielded container created");
					doh.t(container2.incr, "script tag works too");
					doh.f(window.contained3, "child widget not created");
					doh.f(window.contained4, "child widget 2 not created");
				},

				function simpleHTML5(){
					doh.is("object", typeof html5simple, "data-dojo-id export");
					doh.is("object", typeof html5simple2, "data-dojo-id export");

					doh.t(html5simple.simple, "default respecified in props=''");
					doh.f(html5simple2.simple, "default overridden by props=''");

					// test data-dojo-props="simple:false, a:1, b:'two', c:[1,2,3], d:function(){ return this; }, e:{ f:'g' }"
					var it = html5simple2;
					doh.is(1, it.a, "number in param");
					doh.is("two", it.b, "string in param");
					doh.t(it.c instanceof Array, "array in param");
					doh.is(3, it.c.length, "array sanity");
					doh.is("g", it.e.f, "nested object with string");

					// test the function
					doh.is(it, it.d(), "simple 'return this' function");

				},

				function html5inherited(){
					doh.is("object", typeof html5simple3);
					var val = html5simple3.afn();
					doh.is(html5simple3.a * 2, val, "afn() overrides default but calls inherited")
				},

				function html5withMethod(){
					// testing data-dojo-event and data-dojo-args support for dojo/method and dojo/connect
					doh.is("object", typeof htmldojomethod);
					doh.t(htmldojomethod._methodRan, "plain dojo/method ran");

					var x = htmldojomethod.someMethod(2, 2);
					doh.is(14, x, "overridden dojo/method");

					htmldojomethod.diffMethod(2);
					doh.t(htmldojomethod._ran, "ensures original was called first");
					doh.is(2, htmldojomethod._fromvalue, "ensures connected was executed in scope");
				},

				function testOnWatch(){
					// testing script-type dojo/watch and dojo/on
					doh.is("object", typeof objOnWatch);
					objOnWatch.set("strProp1","newValue1");
					doh.is("newValue1", objOnWatch.arrProp.newValue, "ensures watch executed");

					objOnWatch.onclick();
					doh.t(objOnWatch.prototypeOnclick, "ensures original was called");
					doh.t(objOnWatch.boolProp1, "ensure on executed in scope");
				},

				function testOn2(){
					// testing script-type dojo/on, when script comes after another element
					parser.parse("on");
					doh.t("on_form" in window, "widget created");
					on_form.emit("click");
					doh.t(on_form.clicked, "on callback fired");
				},

				function testAspect(){
					// testing script-type dojo/aspect
					doh.is("object", typeof objAspect);
					doh.f(objAspect.method1ran, "ensures method unfired");
					doh.f(objAspect.method2ran, "ensures method unfired");
					doh.is(objAspect.method3result, "", "ensures method unfired");
					doh.f(objAspect.method4ran, "ensures method unfired");

					objAspect.method1();
					objAspect.method2();
					objAspect.method3("something");
					objAspect.method4();

					doh.t(objAspect.method1ran, "method fired");
					doh.t(objAspect.method1after, "after advice fired");
					doh.t(objAspect.method2ran, "method fired");
					doh.t(objAspect.method2before, "around before advice fired");
					doh.t(objAspect.method2after, "around after advice fired");
					doh.is(objAspect.method3result, "before", "before argument passed");
					doh.t(objAspect.method4ran, "method fired");
					doh.t(objAspect.method4after, "after advice fired");
				},

				function testMID(){
					// testing specifying data-dojo-type as mid
					doh.is("object", typeof objAMDWidget);
					doh.is("Value1", objAMDWidget.params.value, "ensure object was properly parsed using MID");
				}
			]);

			doh.register("BIDI", [
				// Test that dir=rtl or dir=ltr setting trickles down from root node
				function dirAttr(){
					parser.parse("dirSection1");
					parser.parse("dirSection2");
					doh.is("rtl", setRtl.dir, "direct setting of dir=rtl works");
					doh.is("rtl", inheritRtl.dir, "inherited rtl works");
					doh.is("ltr", inheritLtr.dir, "inherited ltr works (closest ancestor wins)");
					doh.is("rtl", inheritRtl2.dir, "inherited rtl works, from grandparent");
					doh.is("ltr", setLtr.dir, "direct setting of dir=ltr overrides inherited RTL");
				},
				function langAttr(){
					parser.parse("langSection");
					doh.f(lang in noLang.params, "no lang");
					doh.is("it_it", inheritedLang.lang, "inherited lang works");
					doh.is("en_us", specifiedLang.lang,"direct setting of lang overrides inherited");
				},
				function textdirAttr(){
					parser.parse("textDirSection");
					doh.f("textDir" in noTextdir.params, "no textdir");
					doh.is("rtl", inheritedTextdir.textDir, "inherited textdir works");
					doh.is("ltr", specifiedTextdir.textDir,"direct setting of textdir overrides inherited");
				},
				{
					// Test that calling parser.parse(nodeX) will inherit dir/lang/etc. settings
					// even from <html>
					name: "inheritance from HTML",
					setUp: function(){
						domAttr.set(win.doc.documentElement, {dir: "rtl", lang: "ja-jp", "data-dojo-textdir": "auto"});
						parser.parse("bidiInheritanceFromHtml");
					},
					runTest: function(){
						doh.is("rtl", inheritedFromHtml.params.dir, "dir");
						doh.is("ja-jp", inheritedFromHtml.params.lang, "lang");
						doh.is("auto", inheritedFromHtml.params.textDir, "textDir");
					},
					tearDown: function(){
						array.forEach(["dir", "lang", "data-dojo-textdir"], function(attr){
							win.doc.documentElement.removeAttribute(attr);
						});
					}
				}
			]);

			doh.register("IE attribute detection", [
				function input1(){
					var widgets = parser.instantiate([dom.byId("ieInput1")]);
					var params = widgets[0].params;

					doh.is("checkbox", params.type, "type");
					doh.t(params.disabled, "disabled");
					doh.t(params.checked, "checked");
					doh.t(params.readonly, "readonly");
					doh.is("bar", params.foo, "foo");
					doh.is("zaz", params.bar, "bar");
					doh.is("escaped\"dq", params.bob, "bob");
					doh.is("escaped\'sq", params.frank, "frank");
					//doh.f("value" in params, "value not specified");	// fails in IE8, thinks value=="on"
				},
				function input2(){
					var widgets = parser.instantiate([dom.byId("ieInput2")]);
					var params = widgets[0].params;

					doh.f("type" in params, "type");
					doh.f("name" in params, "name");
					doh.f("value" in params, "value");
					doh.f("data-dojo-type" in params, "data-dojo-type");
					doh.f("data-dojo-props" in params, "data-dojo-props");
					doh.is("hi", params.foo, "foo");
					doh.f("value" in params, "value not specified");
				},
				function input3(){
					var widgets = parser.instantiate([dom.byId("ieInput3")]);
					var params = widgets[0].params;

					doh.is("password", params.type, "type");
					doh.is("test", params.name, "name");
					doh.is("123", params.value, "value");
					doh.is("myClass", params["class"], "class");
					doh.is("display:block", params["style"].replace(/[ ;]/g, "").toLowerCase(), "style");
					doh.is("3", params.tabIndex, "tabIndex");
				},
				function textarea(){
					var widgets = parser.instantiate([dom.byId("ieTextarea")]);
					var params = widgets[0].params;

					doh.is("attrVal", params.value, "value");
				},
				function button1(){
					var widgets = parser.instantiate([dom.byId("ieButton1")]);
					var params = widgets[0].params;
					doh.t(params.checked, "checked");
					doh.is("button1val", params.value, "value");
				},
				function button2(){
					var widgets = parser.instantiate([dom.byId("ieButton2")]);
					var params = widgets[0].params;
					doh.f("checked" in params, "checked");
					doh.f("value" in params, "value");
				},
				function button3(){
					var widgets = parser.instantiate([dom.byId("ieButton3")]);
					var params = widgets[0].params;
					doh.t(params.checked, "checked");
				},
				function button4(){
					var widgets = parser.instantiate([dom.byId("ieButton4")]);
					var params = widgets[0].params;
					doh.f("checked" in params);
				},
				function form1(){
					var widgets = parser.instantiate([dom.byId("ieForm1")]);
					var params = widgets[0].params;

					doh.is("foo", params.encType, "encType is specified");
				},
				function form2(){
					var widgets = parser.instantiate([dom.byId("ieForm2")]);
					var params = widgets[0].params;

					doh.f("encType" in params, "encType not specified")
				},
				function li(){
					var widgets = parser.instantiate([dom.byId("li")]);
					var params = widgets[0].params;
					doh.is("home", params.value);

				}
			]);

			doh.register("mixed attribute specification", function mixed(){
				parser.parse(dom.byId("mixedContainer"));
				doh.is("object", typeof mixedObj, "widget created");
				doh.is("mixedValue", mixedObj.value, "native attribute");
				doh.is(999, mixedObj.custom1, "data-dojo-props attribute");
				doh.is("custom title", mixedObj.title, "data-dojo-props overrides native");
			});

			doh.register("functions", function onclick(){
				// Create objects referenced from markup inside of "functions" div
				declare("tests.parser.Button", null, {
					onClick: function(){
						console.log("prototype click");
					},
					constructor: function(args, node){
						lang.mixin(this, args);
						this.domNode = node;
						aspect.after(this.domNode, "onclick", lang.hitch(this, "onClick"));
					}
				});
				buttonClicked = function(){
					console.log("markup click");
				};	// markup says onClick="buttonClicked"

				// Parse markup inside "functions" div
				parser.parse("functions");

				// Should have created an instance called "button" where button.onClick == buttonClicked
				doh.is("object", typeof button, "widget created");
				doh.is("function", typeof button.onClick, "created as function");
				doh.t(buttonClicked == button.onClick, "points to specified function");
			});

			doh.register("parser.instantiate()", function instantiate1() {
				var nodes = [dom.byId("objId1"),dom.byId("objId2"),dom.byId("contId1"),dom.byId("objId3")];
				parser.instantiate(nodes);
				doh.is("object", typeof objI1, "widget 1 created");
				doh.is("object", typeof objI2, "widget 2 created");
				doh.t(contI1, "container created");
				doh.is("object", typeof objI3, "child widget 3 created");
				doh.f(window.objI4, "child widget 4 not created");
			});

			doh.register("parser.construct()", function construct1() {
				var nodes = [dom.byId("objC1"),dom.byId("objC2")];

				parser.construct(tests.parser.Class1, dom.byId("objC1"));
				doh.is("object", typeof objC1, "widget 1 created");
				doh.is(5, objC1.intProp, "objC1.intProp");

				parser.construct(tests.parser.Class1, dom.byId("objC2"));
				doh.is("object", typeof objC2, "widget 2 created");
				doh.is(5, objC2.intProp, "objC2.intProp");
			});

			doh.register("data-dojo-mixins support", function mixins() {
				parser.parse("mixins");
				doh.t(resultMixins1, "object using data-dojo-mixins created from an already parsed type");
				doh.t(resultMixins1.mixin1Done, "mixin1 correctly mixed in");
				doh.t(resultMixins1.mixin2Done, "mixin2 correctly mixed in");
				doh.t(resultMixins1.amdMixinDone, "amd mixin correctly mixed in");
				doh.t(resultMixins2, "object using data-dojo-mixins created from a non parsed type");
				doh.t(resultMixins2.classDone, "class correctly created");
				doh.t(resultMixins2.mixin1Done, "mixin1 correctly mixed in");
				doh.t(resultMixins2.mixin2Done, "mixin2 correctly mixed in");
				doh.t(resultMixins2.amdMixinDone, "amd mixin correctly mixed in");
				doh.t(resultNonDojoMixin.expectedClass, "correct class is returned for composeJS mixin");
				doh.is(resultNonDojoMixin.params.length, 2, "correct # of params were passed to compose JS");
				doh.is(resultNonDojoMixin.params[0], tests.parser.Mixin1, "correct param 1");
				doh.is(resultNonDojoMixin.params[1], tests.parser.Mixin2, "correct param 2");
			});

			// For any special issues with behavioral widgets (as opposed to Templated)
			doh.register("behavioral", [
				function doubleConnect(){
					// Class used in "behavioral" <div>
					Behavioral1 = declare(null, {
						constructor: function(params, node){
							on(node, "click", lang.hitch(this, "onClick"));
							if(typeof params.onClick != "function"){
								throw new Error("onClick not passed to constructor");
							}
							lang.mixin(this, params);
						},
						onClick: function(){
							console.log("original onnClick handler")
						},
						foo: ""
					});

					parser.parse("behavioral");

					// Setup global accessed by Behavioral1.onclick handler
					behavioralClickCounter = 0;

					// Trigger click event, and make sure that handler was only called once.
					on.emit(dom.byId("bh1"), "click", {bubbles: true, cancelable: true});

					doh.is(1, behavioralClickCounter, "one click event processed");

					doh.is("bar", dom.byId("bh1").getAttribute("foo"), "foo attribute not removed from widget DOMNode");
				}
			]);

			doh.register("script type=dojo/require support", function declarativeRequire(){
				var td = new doh.Deferred();

				parser.parse("declarativeRequire").then(td.getTestCallback(function(){
					doh.is(typeof dr1, "object", "object using MID mapped to return var");
					doh.is(dr1.params.foo, "bar", "parameters set on instantiation");
					doh.is(typeof dr2, "object", "object using MID mapped to return var");
					doh.is(dr2.params.foo, "bar", "parameters set on instantiation");
					doh.is(typeof dr3, "object", "object using fully required");
					doh.is(dr3.params.foo, "bar", "parameters set on instantiation");
					doh.is(dr4.params.foo, 2, "module loaded and executed");
					doh.is(dr5.method1(1), 3, "declarative script has access to parser scope");
				}));

				return td;
			});

			doh.register("context require support", function contextRequire(){
				var td = new doh.Deferred();

				parser.parse("contextRequire", {
					contextRequire: require
				}).then(td.getTestCallback(function(){
					doh.is(typeof cr1, "object", "object using relative MID mapped to return var");
					doh.is(cr1.params.foo, "bar", "parameters set on instantiation");
					doh.is(typeof cr2, "object", "object using relative MID mapped to return var");
					doh.is(cr2.params.foo, "bar", "parameters set on instantiation");
					doh.is(typeof cr3, "object", "object using relative MID mapped to return var");
					doh.is(cr3.params.foo, "bar", "parameters set on instantiation");
					doh.is(typeof cr4, "object", "object using relative MID mapped to return var");
					doh.is(cr4.params.foo, "bar", "parameters set on instantiation");
				}));

				return td;
			});

			doh.register("promise error handling support", [
				function asyncError(){
					var td = new doh.Deferred();

					parser.parse("errorHandling").then(td.getTestErrback(function(){
						throw new Error("shouldn't get here");
					}), td.getTestCallback(function(e){
						doh.is(typeof e, "object", "error object returned");
					}));

					return td;
				},
				function missingCtor(){
					var td = new doh.Deferred();

					parser.parse("missingCtor").then(td.getTestErrback(function(){
						throw new Error("shouldn't get here");
					}), td.getTestCallback(function(e){
						doh.is(typeof e, "object", "error object returned");
						doh.is(e.toString(), "Error: Unable to resolve constructor for: 'some.type'", "proper error value returned");
					}));

					return td;
				}
			]);

			doh.run();
		});
		</script>
	</head>
	<body>
		<h1>Parser Unit Test</h1>

		<div id=main>
			<script>
				function foo(){ this.fooCalled=true; }
			</script>
			<div dojoType="tests.parser.Class1" data-dojo-id="obj"
				 strProp1="text" strProp2=""
				 intProp="5"
				 arrProp="foo, bar, baz"
				 arrProp2=""
				 boolProp1="true" boolProp2="false"
				 dateProp1="2006-01-01" dateProp2="" dateProp3="now"
				 funcProp2="foo" funcProp3="this.func3Called=true;"
			>
				<script type="dojo/method" data-dojo-event="preamble">
					this.preambleTestProp = 3;
				</script>
				<script type="dojo/method">
					// this should be run immediately
					this.deepProp = deepTestProp;
				</script>
				<script type="dojo/connect" data-dojo-event="callInc">
					this.callCount++;
				</script>
				<script type="dojo/method" data-dojo-event="callInc2">
					this.callCount2++;
				</script>
			</div>
			<div dojoType="tests.parser.Class2" jsId="obj3">
			</div>
			<div dojoType="tests.parser.Class3" data-dojo-id="obj4">
			</div>
			<input dojoType="tests.parser.InputClass" data-dojo-id="checkedObj" checked type="checkbox">
			<button dojoType="tests.parser.InputClass" data-dojo-id="disabledObj" disabled>hi</button>

			<div id="parsertest"></div>
			<div id="parsertest2"></div>

			<!-- section for testing parser recursion -->
			<div>
				<div dojoType="tests.parser.NormalContainer" data-dojo-id="container1">
					<!-- this script tag should get passed as param to NormalContainer constructor -->
					<script type="dojo/method" data-dojo-event="incr" data-dojo-args="x">
						return x+1;
					</script>

					<!-- and these contained widgets should get instantiated -->
					<div dojoType="tests.parser.Class1" data-dojo-id="contained1"></div>
					<div>
						<div dojoType="tests.parser.Class1" data-dojo-id="contained2"></div>
					</div>
				</div>
			</div>

			<div>
				<div dojoType="tests.parser.ShieldedContainer" data-dojo-id="container2">
					<!-- this script tag should get passed as param to ShieldedContainer constructor -->
					<script type="dojo/method" data-dojo-event="incr" data-dojo-args="x">
						return x+1;
					</script>

					<!-- but these contained widgets should *not* get instantiated -->
					<div dojoType="tests.parser.Class1" data-dojo-id="contained3"></div>
					<div>
						<div dojoType="tests.parser.Class1" data-dojo-id="contained4"></div>
					</div>
				</div>
			</div>

			<!-- tests for new data-dojo-type / data-dojo-props syntax -->
			<div>
				<div data-dojo-id="html5simple" data-dojo-type="tests.parser.HTML5Props" data-dojo-props="simple:true"></div>
				<div data-dojo-id="html5simple2" data-dojo-type="tests.parser.HTML5Props"
					 data-dojo-props="simple:false, a:1, b:'two', c:[1,2,3], d:function(){ return this; }, e:{ f:'g' }"
				></div>
				<!-- note needing to use a named inherited lookup because we're just mixing in -->
				<div data-dojo-id="html5simple3" data-dojo-type="tests.parser.HTML5Props"
					 data-dojo-props="afn: function(){ return this.inherited('afn', arguments); }"
				></div>

				<!-- not used for tests, but thinking out loud: what about a named-resource prop, via getObject -->
				<div data-dojo-id="html5fromobjectns" data-dojo-type="tests.parser.HTML5Props"
					 data-dojo-obj="tests.parser.HTML5Props._aDefaultObj"
				></div>
				<div data-dojo-id="html5fromobjectns2" data-dojo-type="tests.parser.HTML5Props"
					 data-dojo-obj="tests.parser.HTML5Props._aDefaultObj" data-dojo-props="simple:false"
				></div>

			</div>

			<div>
				<div data-dojo-id="htmldojomethod" data-dojo-type="tests.parser.HTML5withMethod">
					<p>Some random markup</p>
					<script type="dojo/method" data-dojo-event="someMethod" data-dojo-args="a, b">
						return this.baseValue + a + b;
					</script>
					<script type="dojo/connect" data-dojo-event="diffMethod" data-dojo-args="a">
						console.log("diffMethod connect, this is ", this);
						this._fromvalue = a;
					</script>
					<script type="dojo/method">
						this._methodRan = true;
					</script>
					<div data-dojo-id="objAspect" data-dojo-type="tests.parser.MethodClass">
						<script type="dojo/aspect" data-dojo-method="method1" data-dojo-advice="after">
							if(this.method1ran){
								this.method1after = true;
							}
						</script>
						<script type="dojo/aspect" data-dojo-method="method2" data-dojo-advice="around" data-dojo-args="origFn">
							return function(){
								if(!this.method2ran){
									this.method2before = true;
								}
								origFn.call(this);
								if(this.method2ran){
									this.method2after = true;
								}
							};
						</script>
						<script type="dojo/aspect" data-dojo-method="method3" data-dojo-advice="before" data-dojo-args="result">
							if(result == "something"){
								return ["before"];
							}
						</script>
						<script type="dojo/aspect" data-dojo-method="method4">
							if(this.method4ran){
								this.method4after = true;
							}
						</script>
					</div>
				</div>
			</div>

			<!-- section for testing dojo/on and dojo/watch scripts -->
			<div>
				<div data-dojo-id="objOnWatch" data-dojo-type="tests.parser.StatefulClass">
					<script type="dojo/watch" data-dojo-prop="strProp1" data-dojo-args="prop,oldValue,newValue">
						this.set("arrProp",{prop: prop, oldValue: oldValue, newValue: newValue});
					</script>
					<script type="dojo/on" data-dojo-event="click" data-dojo-args="e">
						console.log("diffMethod on, this is ",this);
						this.set("boolProp1",true);
					</script>
				</div>
			</div>

			<!-- section for testing mid syntax for data-dojo-type -->
			<div>
				<div data-dojo-id="objAMDWidget" data-dojo-type="dojo/tests/resources/AMDWidget" data-dojo-props="value: 'Value1'"></div>
			</div>
		</div> <!-- end of <div id=main> -->

		<!-- more dojo/on tests -->
		<div id="on">
			<form action="/SomeUrl" data-dojo-type="tests.parser.StatefulClass" data-dojo-id="on_form">
				<input data-dojo-type="tests.parser.InputClass" name="ACheckBox" />
				<script type="dojo/on" data-dojo-event="click">
					this.clicked = true;
				</script>
			</form>
		</div>

		<!-- section for testing parse on a subnode -->
		<div>
			<div data-dojo-type="tests.parser.Class1" data-dojo-id="obj2" id="toParse">
			</div>
		</div>

		<!-- section for testing that dir, lang attribute trickles down from ancestor -->
		<div id="dirSection1">
			<div dojoType="tests.parser.BidiClass" data-dojo-id="setRtl" dir="rtl" name="RTL setting"></div>
			<div dojoType="tests.parser.BidiClass" data-dojo-id="noDir" name="dir not inherited or set"></div>
		</div>
		<div id="dirSection2" dir="rtl">
			<div dojoType="tests.parser.BidiClass" data-dojo-id="inheritRtl" name="inherited RTL from parent"></div>
			<div dir="ltr">
				<div dojoType="tests.parser.BidiClass" data-dojo-id="inheritLtr" name="inherited LTR from parent"></div>
			</div>
			<div>
				<div dojoType="tests.parser.BidiClass" data-dojo-id="inheritRtl2" name="inherited RTL from grandparent"></div>
			</div>
			<div dojoType="tests.parser.BidiClass" data-dojo-id="setLtr" dir="ltr" name="LTR setting overrides inherited RTL"></div>
		</div>
		<div id="langSection">
			<div dojoType="tests.parser.BidiClass" data-dojo-id="noLang" name="shouldn't get lang"></div>
			<div lang="it_it">
				<div dojoType="tests.parser.BidiClass" data-dojo-id="inheritedLang" name="inherited lang from parent"></div>
				<div dojoType="tests.parser.BidiClass" data-dojo-id="specifiedLang" lang="en_us" name="specified lang overrides parent"></div>
			</div>
		</div>
		<div id="textDirSection">
			<div dojoType="tests.parser.BidiClass" data-dojo-id="noTextdir" name="shouldn't get textdir"></div>
			<div data-dojo-textdir="rtl">
				<div dojoType="tests.parser.BidiClass" data-dojo-id="inheritedTextdir" name="inherited textdir from parent"></div>
				<div dojoType="tests.parser.BidiClass" data-dojo-id="specifiedTextdir" data-dojo-textdir="ltr" name="specified textdir overrides parent"></div>
			</div>
		</div>
		<div id="bidiInheritanceFromHtml">
			<div dojoType="tests.parser.BidiClass" data-dojo-id="inheritedFromHtml" name="should get dir/lang/textDir from HTML tag"></div>
		</div>

		<!-- tests that we can parse parameters correctly on IE6/7, not getting tripped up by escaped quotes etc. -->
		<div id=ie>
			<input id="ieInput1" data-dojo-type="tests.parser.InputClass"
				   type=checkbox disabled foo = 'bar' readonly bar=zaz bob='escaped"dq' frank="escaped'sq" checked />
			<input id="ieInput2" data-dojo-type="tests.parser.InputClass"
				   fakeout1="type=submit" fakeout2="name='test'" fakeout3="value='123'" data-dojo-props="foo: 'hi'"/>
			<input id="ieInput3" data-dojo-type="tests.parser.InputClass"
				   type=password name="test" value="123" class="myClass" style="display:block" tabindex="3"/>
			<textarea id="ieTextarea" data-dojo-type="tests.parser.InputClass" value="attrVal">contentVal</textarea>
			<button id="ieButton1" data-dojo-type="tests.parser.InputClass" checked value="button1val">
				checked ToggleButton as button
			</button>
			<button id="ieButton2" data-dojo-type="tests.parser.InputClass">
				unchecked ToggleButton as button
			</button>
			<div id="ieButton3" data-dojo-type="tests.parser.InputClass" checked>
				checked ToggleButton as div
			</div>
			<div id="ieButton4" data-dojo-type="tests.parser.InputClass">
				unchecked ToggleButton as div
			</div>
			<form id="ieForm1" data-dojo-type="tests.parser.FormClass" encType="foo"></form>
			<form id="ieForm2" data-dojo-type="tests.parser.FormClass"></form>
			<ul dojoType="tests.parser.Widget" class="nav">
				<li id="li" dojoType="tests.parser.Widget" value="home">Home</li>
				<li dojoType="tests.parser.Widget" value="contact">Contact</li>
				<li dojoType="tests.parser.Widget" value="group">Group</li>
				<li dojoType="tests.parser.Widget" value="campaign">Campaign</li>
			</ul>
		</div>

		<!-- tests for when parameters are specified both natively and in data-dojo-props. -->
		<div id="mixedContainer">
			<input data-dojo-type="tests.parser.InputClass" data-dojo-id="mixedObj"
				   value="mixedValue" title="native title" data-dojo-props="custom1: 999, title: 'custom title'">
		</div>

		<!-- tests for function names native to HTML, specifically an issue on IE<8 -->
		<div id="functions">
			<button dojoType="tests.parser.Button" onClick="buttonClicked" data-dojo-id="button">Click me</button>
		</div>

		<!-- section for testing parser.instantiate() -->
		<div id="instantiate1">
			<div dojoType="tests.parser.Class1" data-dojo-id="objI1" id="objId1"
				 strProp1="text" strProp2=""
				 intProp="5"
				 arrProp="foo, bar, baz"
				 arrProp2=""
				 boolProp1="true" boolProp2="false"
				 dateProp1="2006-01-01" dateProp2="" dateProp3="now"
				 funcProp2="foo" funcProp3="this.func3Called=true;"
			>
			</div>
			<div data-dojo-type="tests.parser.Class1" data-dojo-id="objI2" id="objId2"
				 data-dojo-props="
					strProp1:'text',
					strProp2:'',
					intProp:5,
					arrProp:['foo', 'bar', 'baz'],
					arrProp2:[],
					boolProp1:true,
					boolProp2:'false',
					dateProp1:'2006-01-01',
					dateProp2:'',
					dateProp3:'now',
					funcProp2:foo,
					funcProp3:'this.func3Called=true;'"
			>
			</div>
			<div dojoType="tests.parser.NormalContainer" data-dojo-id="contI1" id ="contId1">
				<div dojoType="tests.parser.Class1" data-dojo-id="objI3" id="objId3"></div>
				<div dojoType="tests.parser.Class1" data-dojo-id="objI4" id="objId4"></div>
			</div>
		</div>

		<!-- section for testing parser.construct() -->
		<div id="construct1">
			<div data-dojo-id="objC1" id="objC1"
				 strProp1="text" strProp2=""
				 intProp="5"
				 arrProp="foo, bar, baz"
				 arrProp2=""
				 boolProp1="true" boolProp2="false"
				 dateProp1="2006-01-01" dateProp2="" dateProp3="now"
				 funcProp2="foo" funcProp3="this.func3Called=true;"
			>
			</div>
			<div data-dojo-id="objC2" id="objC2"
				 data-dojo-props="
					strProp1:'text',
					strProp2:'',
					intProp:5,
					arrProp:['foo', 'bar', 'baz'],
					arrProp2:[],
					boolProp1:true,
					boolProp2:'false',
					dateProp1:'2006-01-01',
					dateProp2:'',
					dateProp3:'now',
					funcProp2:foo,
					funcProp3:'this.func3Called=true;'"
			>
			</div>
		</div>

		<!-- tests for data-dojo-mixins -->
		<div id="mixins">
			<div data-dojo-type="tests.parser.Class1" data-dojo-mixins="tests.parser.Mixin1,tests.parser.Mixin2,dojo/tests/resources/AMDMixin"
				 data-dojo-id="resultMixins1"></div>
			<div data-dojo-type="tests.parser.ClassForMixins" data-dojo-mixins="tests.parser.Mixin1, tests.parser.Mixin2, dojo/tests/resources/AMDMixin"
				 data-dojo-id="resultMixins2"></div>
			<div data-dojo-type="MyNonDojoClass" data-dojo-mixins="tests.parser.Mixin1, tests.parser.Mixin2"
				 data-dojo-id="resultNonDojoMixin"></div>
		</div>

		<!-- tests for behavioral widgets -->
		<div id="behavioral">
			<div data-dojo-type="Behavioral1" onClick="behavioralClickCounter++;" id="bh1" foo="bar">click me</div>
		</div>
		
		<!-- tests for declarative require -->
		<div id="declarativeRequire">
			<script type="dojo/require">
				AMDWidget: "dojo/tests/resources/AMDWidget",
				AMDWidget2: "dojo/tests/resources/AMDWidget2"
			</script>
			<div data-dojo-id="dr1" data-dojo-type="AMDWidget" data-dojo-props="foo: 'bar'"></div>
			<div data-dojo-id="dr2" data-dojo-type="AMDWidget2" data-dojo-props="foo: 'bar'"></div>
			<script type="dojo/require">
				AMDWidget3: "dojo/tests/resources/AMDWidget3"
			</script>
			<div data-dojo-id="dr3" data-dojo-type="dojo/tests/resources/AMDWidget3" data-dojo-props="foo: 'bar'"></div>
			<script type="dojo/require">
				amdmodule: "dojo/tests/resources/amdmodule"
			</script>
			<div data-dojo-id="dr4" data-dojo-type="AMDWidget" data-dojo-props="foo: amdmodule(1)"></div>
			<div data-dojo-id="dr5" data-dojo-type="AMDWidget2">
			<script type="dojo/aspect" data-dojo-advice="before" data-dojo-method="method1" data-dojo-args="value">
				return [amdmodule(value)];
			</script>
			</div>
		</div>

		<!-- tests for context require -->
		<!-- The relative MIDs, because they are "up", the loader thinks they are not necessarily modules, in the 
				real world, they would most likely be in sibling paths and the need for the .js would not be
				necessary -->
		<div id="contextRequire">
			<script type="dojo/require">
				"context.AMDWidget": "../resources/AMDWidget.js",
				"context.AMDWidget2": "../resources/AMDWidget2.js"
			</script>
			<div data-dojo-id="cr1" data-dojo-type="context.AMDWidget" data-dojo-props="foo: 'bar'"></div>
			<div data-dojo-id="cr2" data-dojo-type="context.AMDWidget2" data-dojo-props="foo: 'bar'"></div>
			<div data-dojo-id="cr3" data-dojo-type="../resources/AMDWidget.js" data-dojo-props="foo: 'bar'"></div>
			<div data-dojo-id="cr4" data-dojo-type="../resources/AMDWidget3.js" data-dojo-props="foo: 'bar'"></div>
		</div>
		
		<!-- tests for promise error handling -->
		<div id="errorHandling">
			<div data-dojo-type="dojo/tests/resources/AMDWidget" data-dojo-props="foo: bar"></div>
		</div>
		<div id="missingCtor">
			<div data-dojo-type="some.type"></div>
		</div>
	</body>
</html>