dojo.provide("tests.webmap.widget.LabelWindow");

dojo.require("doh.runner");
dojo.require("webmap.widget.LabelWindow");
dojo.require("tests.Util");

var div;
var cont;
var tb;
var tbw;
function doLabelWindowSetup(){
	tests.Util.resetDom();
	div = document.createElement("div");
	document.body.appendChild(div);
	cont = document.createElement("div");
	document.body.appendChild(cont);
	tb = document.createElement("div");
	document.body.appendChild(tb);
	tb.id = "tb";
	tbw = new dijit.Toolbar({}, tb);
}
doh.register("tests.webmap.widget.LabelWindow", 
	[
		{
			name: "postCreate",
			widget: null,
			style: dojo.style,
			connect: dojo.connect,
			call: webmap.widget.LabelWindow.superclass.postCreate.call,
			styleArgs: [],
			connArgs: [],
			callArgs: [],
			appendArgs:[],
			setArgs:[],
			setUp: function(){
				doLabelWindowSetup();
				var _this = this;
				dojo.style = function(a0,a1,a2){_this.styleArgs.push([a0,a1,a2]);};
				dojo.connect = function(a0,a1,a2,a3){_this.connArgs.push([a0,a1,a2,a3]);return "test connection";};
				webmap.widget.LabelWindow.superclass.postCreate.call = function(a){
					_this.callArgs.push(a);
				}
				this.widget = new webmap.widget.LabelWindow({
					toolbar:tbw,
					_pointer:{destroy:function(){}},
					postMixInProperties: function(){},
					templateString:"<div></div>",
					contentNode:{appendChild:function(c){_this.appendArgs.push(c);}},
					_connections: [],
					_setEditor:function(d){
						_this.setArgs.push(d);
						this._editor = {document:{body:"editor body"}};
					}
				},div);
			},
			runTest: function(){
				tests.assertEqual(this.widget.contentNode.domNode, this.widget.pointFromNode);
				tests.assertEqual(1, this.appendArgs.length);
				tests.assertEqual("DIV", this.appendArgs[0].tagName);
				tests.assertEqual([this.widget], this.callArgs);
				tests.assertEqual(2, this.connArgs.length);
				tests.assertEqual([this.widget.domNode, "onmouseover", this.widget, "doHover"], this.connArgs[0]);
				tests.assertEqual([this.widget.domNode, "onmouseout", this.widget, "doMouseout"], this.connArgs[1]);
				while (this.widget._connections.length > 0)
					tests.assertEqual("test connection", this.widget._connections.pop());
				tests.assertEqual(4, this.styleArgs.length);
				tests.assertEqual([this.widget.contentNode, "overflow", "hidden"], this.styleArgs[0]);
				tests.assertEqual([this.widget.contentNode, "visibility", "visible"], this.styleArgs[1]);
				tests.assertEqual([this.widget.contentNode, "backgroundColor", undefined], this.styleArgs[2]);
				tests.assertEqual([this.widget._editor.document.body, "backgroundColor", undefined], this.styleArgs[3]);
			},
			tearDown: function(){
				dojo.style = this.style;
				dojo.connect = this.connect;
				webmap.widget.LabelWindow.superclass.postCreate.call = this.call;
				this.widget.destroy();
			}
		},
		{
			name: "_setEditor",
			widget: null,
			setUp: function(){
			},
			runTest: function(){
				console.warn("Write me!"); try{notWritten++;}catch(ignore){}
			},
			tearDown: function(){
			}
		},
		{
			name: "doHover",
			setUp: function(){
				
			},
			runTest: function(){
					console.warn("Write me!"); try{notWritten++;}catch(ignore){}
			},
			tearDown: function(){
				
			}
		},
		{
			name: "doMouseout",
			setUp: function(){
				
			},
			runTest: function(){
					console.warn("Write me!"); try{notWritten++;}catch(ignore){}
			},
			tearDown: function(){
				
			}
		},
		{
			name: "onAfterHide",
			setUp: function(){
				
			},
			runTest: function(){
					console.warn("Write me!"); try{notWritten++;}catch(ignore){}
			},
			tearDown: function(){
				
			}
		},
		{
			name: "_hideToolbar",
			setUp: function(){
				
			},
			runTest: function(){
					console.warn("Write me!"); try{notWritten++;}catch(ignore){}
			},
			tearDown: function(){
				
			}
		}	
	]
);