From ad2752e2f79aa4302bd78fc4c1ccc320c8c2a515 Mon Sep 17 00:00:00 2001 From: Michael Best Date: Mon, 10 Sep 2018 20:11:55 -0700 Subject: [PATCH] fix references to createChildContextWithAs in specs. see #2403 --- spec/defaultBindings/foreachBehaviors.js | 5 ----- spec/templatingBehaviors.js | 22 ++++++---------------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/spec/defaultBindings/foreachBehaviors.js b/spec/defaultBindings/foreachBehaviors.js index 4366423aa..511a71688 100644 --- a/spec/defaultBindings/foreachBehaviors.js +++ b/spec/defaultBindings/foreachBehaviors.js @@ -735,11 +735,6 @@ describe('Binding: Foreach', function() { } describe('With "noChildContext = true" and "as"', function () { - beforeEach(function() { - this.restoreAfter(ko.options, 'createChildContextWithAs'); - ko.options.createChildContextWithAs = false; - }); - it('Should not create a child context', function () { testNode.innerHTML = "
"; var someItems = ['alpha', 'beta']; diff --git a/spec/templatingBehaviors.js b/spec/templatingBehaviors.js index 4a7a86cf8..b085664a3 100644 --- a/spec/templatingBehaviors.js +++ b/spec/templatingBehaviors.js @@ -1179,17 +1179,12 @@ describe('Templating', function() { expect(testDocFrag.childNodes[0]).toContainHtml("myval: 123"); }); - describe('With "createChildContextWithAs = false" and "as"', function () { - beforeEach(function() { - this.restoreAfter(ko.options, 'createChildContextWithAs'); - ko.options.createChildContextWithAs = false; - }); - + describe('With "noChildContext = true" and "as"', function () { it('Should bind viewmodel to an alias', function() { ko.setTemplateEngine(new dummyTemplateEngine({ myTemplate: "ValueLiteral: [js:item.prop], ValueBound: " })); - testNode.innerHTML = "
"; + testNode.innerHTML = "
"; ko.applyBindings({ someItem: { prop: 'Hello' } }, testNode); expect(testNode.childNodes[0]).toContainText("ValueLiteral: Hello, ValueBound: Hello"); }); @@ -1203,23 +1198,18 @@ describe('Templating', function() { ko.setTemplateEngine(new dummyTemplateEngine({ myTemplate: "ValueLiteral: [js:item.prop], ValueBound: " })); - testNode.innerHTML = "
"; + testNode.innerHTML = "
"; ko.applyBindings({ someItem: myModel, callback: myCallback }, testNode); expect(passedDataItem).toEqual(myModel); }); }); - describe('With "createChildContextWithAs = true" and "as"', function () { - beforeEach(function() { - this.restoreAfter(ko.options, 'createChildContextWithAs'); - ko.options.createChildContextWithAs = true; - }); - + describe('With "noChildContext = false" and "as"', function () { it('Should bind viewmodel to an alias', function() { ko.setTemplateEngine(new dummyTemplateEngine({ myTemplate: "ValueLiteral: [js:item.prop], ValueBound: " })); - testNode.innerHTML = "
"; + testNode.innerHTML = "
"; ko.applyBindings({ someItem: { prop: 'Hello' } }, testNode); expect(testNode.childNodes[0]).toContainText("ValueLiteral: Hello, ValueBound: Hello"); }); @@ -1233,7 +1223,7 @@ describe('Templating', function() { ko.setTemplateEngine(new dummyTemplateEngine({ myTemplate: "ValueLiteral: [js:item.prop], ValueBound: " })); - testNode.innerHTML = "
"; + testNode.innerHTML = "
"; ko.applyBindings({ someItem: myModel, callback: myCallback }, testNode); expect(passedDataItem).toEqual(myModel); });