michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Make sure that the editing or removing watch expressions works properly. michael@0: */ michael@0: michael@0: const TAB_URL = EXAMPLE_URL + "doc_watch-expressions.html"; michael@0: michael@0: let gTab, gDebuggee, gPanel, gDebugger; michael@0: let gL10N, gEditor, gVars, gWatch; michael@0: michael@0: function test() { michael@0: initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { michael@0: gTab = aTab; michael@0: gDebuggee = aDebuggee; michael@0: gPanel = aPanel; michael@0: gDebugger = gPanel.panelWin; michael@0: gL10N = gDebugger.L10N; michael@0: gEditor = gDebugger.DebuggerView.editor; michael@0: gVars = gDebugger.DebuggerView.Variables; michael@0: gWatch = gDebugger.DebuggerView.WatchExpressions; michael@0: michael@0: waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_WATCH_EXPRESSIONS) michael@0: .then(() => testInitialVariablesInScope()) michael@0: .then(() => testInitialExpressionsInScope()) michael@0: .then(() => testModification("document.title = 42", "document.title = 43", "43", "undefined")) michael@0: .then(() => testIntegrity1()) michael@0: .then(() => testModification("aArg", "aArg = 44", "44", "44")) michael@0: .then(() => testIntegrity2()) michael@0: .then(() => testModification("aArg = 44", "\ \t\r\ndocument.title\ \t\r\n", "\"43\"", "44")) michael@0: .then(() => testIntegrity3()) michael@0: .then(() => testModification("document.title = 43", "\ \t\r\ndocument.title\ \t\r\n", "\"43\"", "44")) michael@0: .then(() => testIntegrity4()) michael@0: .then(() => testModification("document.title", "\ \t\r\n", "\"43\"", "44")) michael@0: .then(() => testIntegrity5()) michael@0: .then(() => testExprDeletion("this", "44")) michael@0: .then(() => testIntegrity6()) michael@0: .then(() => testExprFinalDeletion("ermahgerd", "44")) michael@0: .then(() => testIntegrity7()) michael@0: .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) michael@0: .then(null, aError => { michael@0: ok(false, "Got an error: " + aError.message + "\n" + aError.stack); michael@0: }); michael@0: michael@0: addExpressions(); michael@0: gDebuggee.ermahgerd(); michael@0: }); michael@0: } michael@0: michael@0: function addExpressions() { michael@0: addExpression("this"); michael@0: addExpression("ermahgerd"); michael@0: addExpression("aArg"); michael@0: addExpression("document.title"); michael@0: addCmdExpression("document.title = 42"); michael@0: michael@0: is(gWatch.itemCount, 5, michael@0: "There should be 5 items availalble in the watch expressions view."); michael@0: michael@0: is(gWatch.getItemAtIndex(4).attachment.initialExpression, "this", michael@0: "The first expression's initial value should be correct."); michael@0: is(gWatch.getItemAtIndex(3).attachment.initialExpression, "ermahgerd", michael@0: "The second expression's initial value should be correct."); michael@0: is(gWatch.getItemAtIndex(2).attachment.initialExpression, "aArg", michael@0: "The third expression's initial value should be correct."); michael@0: is(gWatch.getItemAtIndex(1).attachment.initialExpression, "document.title", michael@0: "The fourth expression's initial value should be correct."); michael@0: is(gWatch.getItemAtIndex(0).attachment.initialExpression, "document.title = 42", michael@0: "The fifth expression's initial value should be correct."); michael@0: michael@0: is(gWatch.getItemAtIndex(4).attachment.currentExpression, "this", michael@0: "The first expression's current value should be correct."); michael@0: is(gWatch.getItemAtIndex(3).attachment.currentExpression, "ermahgerd", michael@0: "The second expression's current value should be correct."); michael@0: is(gWatch.getItemAtIndex(2).attachment.currentExpression, "aArg", michael@0: "The third expression's current value should be correct."); michael@0: is(gWatch.getItemAtIndex(1).attachment.currentExpression, "document.title", michael@0: "The fourth expression's current value should be correct."); michael@0: is(gWatch.getItemAtIndex(0).attachment.currentExpression, "document.title = 42", michael@0: "The fifth expression's current value should be correct."); michael@0: } michael@0: michael@0: function testInitialVariablesInScope() { michael@0: let localScope = gVars.getScopeAtIndex(1); michael@0: let argVar = localScope.get("aArg"); michael@0: michael@0: is(argVar.visible, true, michael@0: "Should have the right visibility state for 'aArg'."); michael@0: is(argVar.name, "aArg", michael@0: "Should have the right name for 'aArg'."); michael@0: is(argVar.value.type, "undefined", michael@0: "Should have the right initial value for 'aArg'."); michael@0: } michael@0: michael@0: function testInitialExpressionsInScope() { michael@0: let exprScope = gVars.getScopeAtIndex(0); michael@0: let thisExpr = exprScope.get("this"); michael@0: let ermExpr = exprScope.get("ermahgerd"); michael@0: let argExpr = exprScope.get("aArg"); michael@0: let docExpr = exprScope.get("document.title"); michael@0: let docExpr2 = exprScope.get("document.title = 42"); michael@0: michael@0: ok(exprScope, michael@0: "There should be a wach expressions scope in the variables view."); michael@0: is(exprScope.name, gL10N.getStr("watchExpressionsScopeLabel"), michael@0: "The scope's name should be marked as 'Watch Expressions'."); michael@0: is(exprScope._store.size, 5, michael@0: "There should be 5 evaluations available."); michael@0: michael@0: is(thisExpr.visible, true, michael@0: "Should have the right visibility state for 'this'."); michael@0: is(thisExpr.target.querySelectorAll(".variables-view-delete").length, 1, michael@0: "Should have the one close button visible for 'this'."); michael@0: is(thisExpr.name, "this", michael@0: "Should have the right name for 'this'."); michael@0: is(thisExpr.value.type, "object", michael@0: "Should have the right value type for 'this'."); michael@0: is(thisExpr.value.class, "Window", michael@0: "Should have the right value type for 'this'."); michael@0: michael@0: is(ermExpr.visible, true, michael@0: "Should have the right visibility state for 'ermahgerd'."); michael@0: is(ermExpr.target.querySelectorAll(".variables-view-delete").length, 1, michael@0: "Should have the one close button visible for 'ermahgerd'."); michael@0: is(ermExpr.name, "ermahgerd", michael@0: "Should have the right name for 'ermahgerd'."); michael@0: is(ermExpr.value.type, "object", michael@0: "Should have the right value type for 'ermahgerd'."); michael@0: is(ermExpr.value.class, "Function", michael@0: "Should have the right value type for 'ermahgerd'."); michael@0: michael@0: is(argExpr.visible, true, michael@0: "Should have the right visibility state for 'aArg'."); michael@0: is(argExpr.target.querySelectorAll(".variables-view-delete").length, 1, michael@0: "Should have the one close button visible for 'aArg'."); michael@0: is(argExpr.name, "aArg", michael@0: "Should have the right name for 'aArg'."); michael@0: is(argExpr.value.type, "undefined", michael@0: "Should have the right value for 'aArg'."); michael@0: michael@0: is(docExpr.visible, true, michael@0: "Should have the right visibility state for 'document.title'."); michael@0: is(docExpr.target.querySelectorAll(".variables-view-delete").length, 1, michael@0: "Should have the one close button visible for 'document.title'."); michael@0: is(docExpr.name, "document.title", michael@0: "Should have the right name for 'document.title'."); michael@0: is(docExpr.value, "42", michael@0: "Should have the right value for 'document.title'."); michael@0: michael@0: is(docExpr2.visible, true, michael@0: "Should have the right visibility state for 'document.title = 42'."); michael@0: is(docExpr2.target.querySelectorAll(".variables-view-delete").length, 1, michael@0: "Should have the one close button visible for 'document.title = 42'."); michael@0: is(docExpr2.name, "document.title = 42", michael@0: "Should have the right name for 'document.title = 42'."); michael@0: is(docExpr2.value, 42, michael@0: "Should have the right value for 'document.title = 42'."); michael@0: michael@0: is(gDebugger.document.querySelectorAll(".dbg-expression[hidden=true]").length, 5, michael@0: "There should be 5 hidden nodes in the watch expressions container."); michael@0: is(gDebugger.document.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, michael@0: "There should be 0 visible nodes in the watch expressions container."); michael@0: } michael@0: michael@0: function testModification(aName, aNewValue, aNewResult, aArgResult) { michael@0: let exprScope = gVars.getScopeAtIndex(0); michael@0: let exprVar = exprScope.get(aName); michael@0: michael@0: let finished = promise.all([ michael@0: waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES), michael@0: waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_WATCH_EXPRESSIONS) michael@0: ]) michael@0: .then(() => { michael@0: let localScope = gVars.getScopeAtIndex(1); michael@0: let argVar = localScope.get("aArg"); michael@0: michael@0: is(argVar.visible, true, michael@0: "Should have the right visibility state for 'aArg'."); michael@0: is(argVar.target.querySelector(".name").getAttribute("value"), "aArg", michael@0: "Should have the right name for 'aArg'."); michael@0: is(argVar.target.querySelector(".value").getAttribute("value"), aArgResult, michael@0: "Should have the right new value for 'aArg'."); michael@0: michael@0: let exprScope = gVars.getScopeAtIndex(0); michael@0: let exprOldVar = exprScope.get(aName); michael@0: let exprNewVar = exprScope.get(aNewValue.trim()); michael@0: michael@0: if (!aNewValue.trim()) { michael@0: ok(!exprOldVar, michael@0: "The old watch expression should have been removed."); michael@0: ok(!exprNewVar, michael@0: "No new watch expression should have been added."); michael@0: } else { michael@0: ok(!exprOldVar, michael@0: "The old watch expression should have been removed."); michael@0: ok(exprNewVar, michael@0: "The new watch expression should have been added."); michael@0: michael@0: is(exprNewVar.visible, true, michael@0: "Should have the right visibility state for the watch expression."); michael@0: is(exprNewVar.target.querySelector(".name").getAttribute("value"), aNewValue.trim(), michael@0: "Should have the right name for the watch expression."); michael@0: is(exprNewVar.target.querySelector(".value").getAttribute("value"), aNewResult, michael@0: "Should have the right new value for the watch expression."); michael@0: } michael@0: }); michael@0: michael@0: let varValue = exprVar.target.querySelector(".title > .name"); michael@0: EventUtils.sendMouseEvent({ type: "dblclick" }, varValue, gDebugger); michael@0: michael@0: let varInput = exprVar.target.querySelector(".title > .element-name-input"); michael@0: setText(varInput, aNewValue); michael@0: EventUtils.sendKey("RETURN", gDebugger); michael@0: michael@0: return finished; michael@0: } michael@0: michael@0: function testExprDeletion(aName, aArgResult) { michael@0: let exprScope = gVars.getScopeAtIndex(0); michael@0: let exprVar = exprScope.get(aName); michael@0: michael@0: let finished = promise.all([ michael@0: waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES), michael@0: waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_WATCH_EXPRESSIONS) michael@0: ]) michael@0: .then(() => { michael@0: let localScope = gVars.getScopeAtIndex(1); michael@0: let argVar = localScope.get("aArg"); michael@0: michael@0: is(argVar.visible, true, michael@0: "Should have the right visibility state for 'aArg'."); michael@0: is(argVar.target.querySelector(".name").getAttribute("value"), "aArg", michael@0: "Should have the right name for 'aArg'."); michael@0: is(argVar.target.querySelector(".value").getAttribute("value"), aArgResult, michael@0: "Should have the right new value for 'aArg'."); michael@0: michael@0: let exprScope = gVars.getScopeAtIndex(0); michael@0: let exprOldVar = exprScope.get(aName); michael@0: michael@0: ok(!exprOldVar, michael@0: "The watch expression should have been deleted."); michael@0: }); michael@0: michael@0: let varDelete = exprVar.target.querySelector(".variables-view-delete"); michael@0: EventUtils.sendMouseEvent({ type: "click" }, varDelete, gDebugger); michael@0: michael@0: return finished; michael@0: } michael@0: michael@0: function testExprFinalDeletion(aName, aArgResult) { michael@0: let exprScope = gVars.getScopeAtIndex(0); michael@0: let exprVar = exprScope.get(aName); michael@0: michael@0: let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES).then(() => { michael@0: let localScope = gVars.getScopeAtIndex(0); michael@0: let argVar = localScope.get("aArg"); michael@0: michael@0: is(argVar.visible, true, michael@0: "Should have the right visibility state for 'aArg'."); michael@0: is(argVar.target.querySelector(".name").getAttribute("value"), "aArg", michael@0: "Should have the right name for 'aArg'."); michael@0: is(argVar.target.querySelector(".value").getAttribute("value"), aArgResult, michael@0: "Should have the right new value for 'aArg'."); michael@0: michael@0: let exprScope = gVars.getScopeAtIndex(0); michael@0: let exprOldVar = exprScope.get(aName); michael@0: michael@0: ok(!exprOldVar, michael@0: "The watch expression should have been deleted."); michael@0: }); michael@0: michael@0: let varDelete = exprVar.target.querySelector(".variables-view-delete"); michael@0: EventUtils.sendMouseEvent({ type: "click" }, varDelete, gDebugger); michael@0: michael@0: return finished; michael@0: } michael@0: michael@0: function testIntegrity1() { michael@0: is(gDebugger.document.querySelectorAll(".dbg-expression[hidden=true]").length, 5, michael@0: "There should be 5 hidden nodes in the watch expressions container."); michael@0: is(gDebugger.document.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, michael@0: "There should be 0 visible nodes in the watch expressions container."); michael@0: michael@0: let exprScope = gVars.getScopeAtIndex(0); michael@0: ok(exprScope, michael@0: "There should be a wach expressions scope in the variables view."); michael@0: is(exprScope.name, gL10N.getStr("watchExpressionsScopeLabel"), michael@0: "The scope's name should be marked as 'Watch Expressions'."); michael@0: is(exprScope._store.size, 5, michael@0: "There should be 5 visible evaluations available."); michael@0: michael@0: is(gWatch.itemCount, 5, michael@0: "There should be 5 hidden expression input available."); michael@0: is(gWatch.getItemAtIndex(0).attachment.view.inputNode.value, "document.title = 43", michael@0: "The first textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(0).attachment.currentExpression, "document.title = 43", michael@0: "The first textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(1).attachment.view.inputNode.value, "document.title", michael@0: "The second textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(1).attachment.currentExpression, "document.title", michael@0: "The second textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(2).attachment.view.inputNode.value, "aArg", michael@0: "The third textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(2).attachment.currentExpression, "aArg", michael@0: "The third textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(3).attachment.view.inputNode.value, "ermahgerd", michael@0: "The fourth textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(3).attachment.currentExpression, "ermahgerd", michael@0: "The fourth textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(4).attachment.view.inputNode.value, "this", michael@0: "The fifth textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(4).attachment.currentExpression, "this", michael@0: "The fifth textbox input value is not the correct one."); michael@0: } michael@0: michael@0: function testIntegrity2() { michael@0: is(gDebugger.document.querySelectorAll(".dbg-expression[hidden=true]").length, 5, michael@0: "There should be 5 hidden nodes in the watch expressions container."); michael@0: is(gDebugger.document.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, michael@0: "There should be 0 visible nodes in the watch expressions container."); michael@0: michael@0: let exprScope = gVars.getScopeAtIndex(0); michael@0: ok(exprScope, michael@0: "There should be a wach expressions scope in the variables view."); michael@0: is(exprScope.name, gL10N.getStr("watchExpressionsScopeLabel"), michael@0: "The scope's name should be marked as 'Watch Expressions'."); michael@0: is(exprScope._store.size, 5, michael@0: "There should be 5 visible evaluations available."); michael@0: michael@0: is(gWatch.itemCount, 5, michael@0: "There should be 5 hidden expression input available."); michael@0: is(gWatch.getItemAtIndex(0).attachment.view.inputNode.value, "document.title = 43", michael@0: "The first textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(0).attachment.currentExpression, "document.title = 43", michael@0: "The first textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(1).attachment.view.inputNode.value, "document.title", michael@0: "The second textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(1).attachment.currentExpression, "document.title", michael@0: "The second textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(2).attachment.view.inputNode.value, "aArg = 44", michael@0: "The third textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(2).attachment.currentExpression, "aArg = 44", michael@0: "The third textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(3).attachment.view.inputNode.value, "ermahgerd", michael@0: "The fourth textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(3).attachment.currentExpression, "ermahgerd", michael@0: "The fourth textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(4).attachment.view.inputNode.value, "this", michael@0: "The fifth textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(4).attachment.currentExpression, "this", michael@0: "The fifth textbox input value is not the correct one."); michael@0: } michael@0: michael@0: function testIntegrity3() { michael@0: is(gDebugger.document.querySelectorAll(".dbg-expression[hidden=true]").length, 4, michael@0: "There should be 4 hidden nodes in the watch expressions container."); michael@0: is(gDebugger.document.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, michael@0: "There should be 0 visible nodes in the watch expressions container."); michael@0: michael@0: let exprScope = gVars.getScopeAtIndex(0); michael@0: ok(exprScope, michael@0: "There should be a wach expressions scope in the variables view."); michael@0: is(exprScope.name, gL10N.getStr("watchExpressionsScopeLabel"), michael@0: "The scope's name should be marked as 'Watch Expressions'."); michael@0: is(exprScope._store.size, 4, michael@0: "There should be 4 visible evaluations available."); michael@0: michael@0: is(gWatch.itemCount, 4, michael@0: "There should be 4 hidden expression input available."); michael@0: is(gWatch.getItemAtIndex(0).attachment.view.inputNode.value, "document.title = 43", michael@0: "The first textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(0).attachment.currentExpression, "document.title = 43", michael@0: "The first textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(1).attachment.view.inputNode.value, "document.title", michael@0: "The second textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(1).attachment.currentExpression, "document.title", michael@0: "The second textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(2).attachment.view.inputNode.value, "ermahgerd", michael@0: "The third textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(2).attachment.currentExpression, "ermahgerd", michael@0: "The third textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(3).attachment.view.inputNode.value, "this", michael@0: "The fourth textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(3).attachment.currentExpression, "this", michael@0: "The fourth textbox input value is not the correct one."); michael@0: } michael@0: michael@0: function testIntegrity4() { michael@0: is(gDebugger.document.querySelectorAll(".dbg-expression[hidden=true]").length, 3, michael@0: "There should be 3 hidden nodes in the watch expressions container."); michael@0: is(gDebugger.document.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, michael@0: "There should be 0 visible nodes in the watch expressions container."); michael@0: michael@0: let exprScope = gVars.getScopeAtIndex(0); michael@0: ok(exprScope, michael@0: "There should be a wach expressions scope in the variables view."); michael@0: is(exprScope.name, gL10N.getStr("watchExpressionsScopeLabel"), michael@0: "The scope's name should be marked as 'Watch Expressions'."); michael@0: is(exprScope._store.size, 3, michael@0: "There should be 3 visible evaluations available."); michael@0: michael@0: is(gWatch.itemCount, 3, michael@0: "There should be 3 hidden expression input available."); michael@0: is(gWatch.getItemAtIndex(0).attachment.view.inputNode.value, "document.title", michael@0: "The first textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(0).attachment.currentExpression, "document.title", michael@0: "The first textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(1).attachment.view.inputNode.value, "ermahgerd", michael@0: "The second textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(1).attachment.currentExpression, "ermahgerd", michael@0: "The second textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(2).attachment.view.inputNode.value, "this", michael@0: "The third textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(2).attachment.currentExpression, "this", michael@0: "The third textbox input value is not the correct one."); michael@0: } michael@0: michael@0: function testIntegrity5() { michael@0: is(gDebugger.document.querySelectorAll(".dbg-expression[hidden=true]").length, 2, michael@0: "There should be 2 hidden nodes in the watch expressions container."); michael@0: is(gDebugger.document.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, michael@0: "There should be 0 visible nodes in the watch expressions container."); michael@0: michael@0: let exprScope = gVars.getScopeAtIndex(0); michael@0: ok(exprScope, michael@0: "There should be a wach expressions scope in the variables view."); michael@0: is(exprScope.name, gL10N.getStr("watchExpressionsScopeLabel"), michael@0: "The scope's name should be marked as 'Watch Expressions'."); michael@0: is(exprScope._store.size, 2, michael@0: "There should be 2 visible evaluations available."); michael@0: michael@0: is(gWatch.itemCount, 2, michael@0: "There should be 2 hidden expression input available."); michael@0: is(gWatch.getItemAtIndex(0).attachment.view.inputNode.value, "ermahgerd", michael@0: "The first textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(0).attachment.currentExpression, "ermahgerd", michael@0: "The first textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(1).attachment.view.inputNode.value, "this", michael@0: "The second textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(1).attachment.currentExpression, "this", michael@0: "The second textbox input value is not the correct one."); michael@0: } michael@0: michael@0: function testIntegrity6() { michael@0: is(gDebugger.document.querySelectorAll(".dbg-expression[hidden=true]").length, 1, michael@0: "There should be 1 hidden nodes in the watch expressions container."); michael@0: is(gDebugger.document.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, michael@0: "There should be 0 visible nodes in the watch expressions container."); michael@0: michael@0: let exprScope = gVars.getScopeAtIndex(0); michael@0: ok(exprScope, michael@0: "There should be a wach expressions scope in the variables view."); michael@0: is(exprScope.name, gL10N.getStr("watchExpressionsScopeLabel"), michael@0: "The scope's name should be marked as 'Watch Expressions'."); michael@0: is(exprScope._store.size, 1, michael@0: "There should be 1 visible evaluation available."); michael@0: michael@0: is(gWatch.itemCount, 1, michael@0: "There should be 1 hidden expression input available."); michael@0: is(gWatch.getItemAtIndex(0).attachment.view.inputNode.value, "ermahgerd", michael@0: "The first textbox input value is not the correct one."); michael@0: is(gWatch.getItemAtIndex(0).attachment.currentExpression, "ermahgerd", michael@0: "The first textbox input value is not the correct one."); michael@0: } michael@0: michael@0: function testIntegrity7() { michael@0: is(gDebugger.document.querySelectorAll(".dbg-expression[hidden=true]").length, 0, michael@0: "There should be 0 hidden nodes in the watch expressions container."); michael@0: is(gDebugger.document.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, michael@0: "There should be 0 visible nodes in the watch expressions container."); michael@0: michael@0: let localScope = gVars.getScopeAtIndex(0); michael@0: ok(localScope, michael@0: "There should be a local scope in the variables view."); michael@0: isnot(localScope.name, gL10N.getStr("watchExpressionsScopeLabel"), michael@0: "The scope's name should not be marked as 'Watch Expressions'."); michael@0: isnot(localScope._store.size, 0, michael@0: "There should be some variables available."); michael@0: michael@0: is(gWatch.itemCount, 0, michael@0: "The watch expressions container should be empty."); michael@0: } michael@0: michael@0: function addExpression(aString) { michael@0: gWatch.addExpression(aString); michael@0: gEditor.focus(); michael@0: } michael@0: michael@0: function addCmdExpression(aString) { michael@0: gWatch._onCmdAddExpression(aString); michael@0: gEditor.focus(); michael@0: } michael@0: michael@0: registerCleanupFunction(function() { michael@0: gTab = null; michael@0: gDebuggee = null; michael@0: gPanel = null; michael@0: gDebugger = null; michael@0: gL10N = null; michael@0: gEditor = null; michael@0: gVars = null; michael@0: gWatch = null; michael@0: });