Browse files

add test for failure on depth traversal termination when the dom does…

…n't mirror the data
  • Loading branch information...
1 parent 50bb3b1 commit 45ccf9a655d8cc88e2bc005e3c3bf2e685b3af59 @tmpvar committed May 21, 2011
Showing with 32 additions and 2 deletions.
  1. +12 −0 test/test.html
  2. +20 −2 test/test.js
View
12 test/test.html
@@ -126,6 +126,18 @@ <h1 class="name">Another Person's name</h1>
<div id="test" class="test" style="display: none">
<span class="name"></span> : <span class="data"></span>
</div>
+
+ <div id="depth-failure-on-miss">
+ <h1>Edit</h1>
+ <form action="/urls" method="post">
+ <p>created on:<span class="create-date"></span></p>
+ <p class="content">
+ <label>Url:</label><input name="url" />
+ </p>
+ <input type="submit" value="save" />
+ </form>
+ </div>
+
</div>
</body>
</html>
View
22 test/test.js
@@ -390,7 +390,25 @@
test.ok($('.contact .age', container).text() === '10000');
test.done();
});
- }
-
+ },
+
+ "Test 17: depth traversal shouldn't stop on a missed key" : function(test) {
+ getTemplate('depth-failure-on-miss', function(window, weld, $, container) {
+ var data = {
+ 'create-date' : 'yesterday',
+ url : {
+ href : "http://www.google.com",
+ title : "Google"
+ }
+ };
+
+ weld(container, data);
+
+ test.ok($(':input[name=href]').val() === data.url.href);
+ test.ok($(':input[name=title]').val() === data.url.href);
+
+ test.done();
+ })
+ }
};
}((typeof module === "undefined") ? window : module.exports));

2 comments on commit 45ccf9a

@0x00A
Collaborator

this is critical i cant believe we missed this!

@tmpvar
Owner

yeah, this commit is flawed. see d8f472c for a functional test.

Please sign in to comment.