Skip to content

Commit

Permalink
Fix deepEqual on Safari 9 due to Safari enumeration bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Oct 14, 2015
1 parent 89487b9 commit 445d603
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/unit/notify-path.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@

<script>

// Safari 9 has a horrible bug related to array enumeration after defining
// a non-enumerable property on it (we do for `.splices`); for now we work
// around chai's deepEqual implementation that enumerates array keys using
// `for in` in the specific case the bug causes an assert failure
function arraysEqual(a, b) {
for (var i=0; i<a.length; i++) {
if (a[i] !== b[i]) {
throw new Error('expected ' + a + ' to equal ' + b);
}
}
if (a.length != b.length) {
throw new Error('expected ' + a + ' to equal ' + b);
}
}

suite('basic path bindings', function() {

var el;
Expand Down Expand Up @@ -1303,7 +1318,7 @@
};
el.set('array.0', -1);
// Verify array contents
assert.deepEqual(el.array, [-1, 99, 2, 3]);
arraysEqual(el.array, [-1, 99, 2, 3]);
});

});
Expand Down

0 comments on commit 445d603

Please sign in to comment.