Skip to content
This repository was archived by the owner on Apr 11, 2023. It is now read-only.

Commit c0a43ee

Browse files
committed
Fix model binder global Container reference, fix Knockout unit tests global Container reference
1 parent bd4ea5c commit c0a43ee

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

src/Types/ModelBinder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,8 @@ $data.Class.define('$data.ModelBinder', null, null, {
389389
/*var beautify = require('beautifyjs');
390390
console.log(beautify.js_beautify(context.src));*/
391391

392-
var fn = new Function('meta', 'data', context.src).bind(this);
393-
var ret = fn(meta, data);
392+
var fn = new Function('meta', 'data', 'Container', context.src).bind(this);
393+
var ret = fn(meta, data, Container);
394394
return ret;
395395
}
396396
});

test.html

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,8 @@
2626
<script type="text/javascript" src="dist/public/jaydatamodules/knockout.js" /></script>
2727
<script type="text/javascript" src="dist/public/jaydatamodules/validate.js" /></script>
2828

29-
<script>
30-
var $data = require('jaydata/core')
31-
Container = $data.Container
32-
//$data = jaydata
33-
/*$C = $data.$C
34-
Container = $data.Container
35-
Guard = $data.Guard
36-
Exception = $data.Exception*/
37-
</script>
38-
3929
<script>
4030
$data.setModelContainer(window)
41-
4231
//$data.setGlobal(window)
4332
</script>
4433
<script type="text/javascript" src="test/qunit/NewsReaderContext.js" /></script>

test/qunit/scripts/knockoutTests.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ function knockoutTests(providerConfig) {
1414
test("knockout observable entity", 11, function () {
1515
var article = new $news.Types.Article();
1616
stop(1);
17-
equal(Container.isTypeRegistered('$news.Types.ObservableArticle'), false, 'Observable article not exists failed');
17+
equal($data.Container.isTypeRegistered('$news.Types.ObservableArticle'), false, 'Observable article not exists failed');
1818
start();
1919
equal(typeof article.asKoObservable, 'function', 'Entity observable convert function failed');
2020

2121
var koArticle = article.asKoObservable();
22-
equal(Container.isTypeRegistered('$news.Types.ObservableArticle'), true, 'Observable article exists failed');
22+
equal($data.Container.isTypeRegistered('$news.Types.ObservableArticle'), true, 'Observable article exists failed');
2323
ok(article === koArticle.innerInstance, 'Inner instance reference failed');
2424
equal(koArticle instanceof $news.Types.ObservableArticle, true, 'Observable type failed');
2525
equal(koArticle instanceof $data.Entity, false, 'Observable instance not subclass of $data.Entity failed');
@@ -448,4 +448,4 @@ function knockoutTests(providerConfig) {
448448
});
449449
});
450450
});
451-
}
451+
}

0 commit comments

Comments
 (0)