Skip to content

Commit

Permalink
Merge pull request #221 from donejs/inc
Browse files Browse the repository at this point in the history
Render immediately when incrementally rendering
  • Loading branch information
matthewp authored Jun 25, 2019
2 parents 9a2cf03 + 0eee478 commit f46cf64
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/template.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,9 @@ define(<%= imports %>, function(<%= args %>){
});

return {
fragment: renderData.fragment,
promise: zonePromise,
viewModel: viewModel,
zoneData: zone.data
};
}
Expand Down
10 changes: 10 additions & 0 deletions test/autorender_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,13 @@ QUnit.module("Memory leaks", {
QUnit.test("Exposes the nodeList", function() {
F("#root").text("true", "Exposed");
});

QUnit.module("Incremental rendering", {
setup: function(assert) {
F.open("//incremental/index.html");
}
});

QUnit.test("Reattaches immediately", function() {
F("h1").exists("Rendered immediately");
});
11 changes: 11 additions & 0 deletions test/incremental/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var DefineMap = require("can-define/map/map");
var route = require("can-route");

var AppViewModel = DefineMap.extend({
page: "string",
hello: function hello() {
return "world";
}
});

module.exports = AppViewModel;
9 changes: 9 additions & 0 deletions test/incremental/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html data-incrementally-rendered>
<head>
<title>Incremental tests</title>
</head>
<body>
<script src="../../node_modules/steal/steal.js"
data-main="test/incremental/index.stache!done-autorender"></script>
</body>
</html>
9 changes: 9 additions & 0 deletions test/incremental/index.stache
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html>
<head>
<title>Testing</title>
</head>
<body>
<can-import from="test/incremental/app" export-as="viewModel" />
<h1>Hello world!</h1>
</body>
</html>

0 comments on commit f46cf64

Please sign in to comment.