From 32869fef612617de9db8362c6805dcf5373157bf Mon Sep 17 00:00:00 2001 From: Jason San Jose Date: Fri, 13 Jan 2012 14:36:06 -0800 Subject: [PATCH] Use closure for testWindow --- test/spec/FileCommandHandlers-test.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/spec/FileCommandHandlers-test.js b/test/spec/FileCommandHandlers-test.js index 05620ff5a..506db496c 100644 --- a/test/spec/FileCommandHandlers-test.js +++ b/test/spec/FileCommandHandlers-test.js @@ -9,13 +9,15 @@ define(function(require, exports, module) { describe("FileCommandHandlers", function() { - var testPath = SpecRunnerUtils.getTestPath("/spec/FileCommandHandlers-test-files"); + var testPath = SpecRunnerUtils.getTestPath("/spec/FileCommandHandlers-test-files") + , testWindow; + var TEST_JS_CONTENT = 'var myContent="This is awesome!";'; var TEST_JS_NEW_CONTENT = "hello world"; beforeEach(function() { - SpecRunnerUtils.beforeTestWindow( this, function( testWindow ) { - this.testWindow = testWindow; + SpecRunnerUtils.beforeTestWindow( this, function( w ) { + testWindow = w; // Load module instances from brackets.test CommandManager = testWindow.brackets.test.CommandManager; @@ -45,7 +47,7 @@ define(function(require, exports, module) { waitsFor(function() { return didClose && !gotError; }, 1000); runs(function() { - expect(this.testWindow.$("#main-toolbar .title").text()).toBe("Untitled"); + expect(testWindow.$("#main-toolbar .title").text()).toBe("Untitled"); }); }); @@ -68,7 +70,7 @@ define(function(require, exports, module) { waitsFor(function() { return didClose && !gotError; }, 1000); runs(function() { - expect(this.testWindow.$("#main-toolbar .title").text()).toBe("Untitled"); + expect(testWindow.$("#main-toolbar .title").text()).toBe("Untitled"); }); }); });