jstd = jstestdriver; dump = bind(jstd.console, jstd.console.log); function nakedExpect(obj) { return expect(angular.fromJson(angular.toJson(obj))); } angularService('$browser', function(){ return new MockBrowser(); }); function childNode(element, index) { return jqLite(element[0].childNodes[index]); } function sortedHtml(element) { var html = ""; (function toString(node) { if (node.nodeName == "#text") { html += escapeHtml(node.nodeValue); } else { html += '<' + node.nodeName.toLowerCase(); var attributes = node.attributes || []; var attrs = []; for(var i=0; i'; } })(element[0]); return html; } function isVisible(node) { var display = node.css('display'); if (display == 'block') display = ""; return display != 'none'; } function assertHidden(node) { var display = node.css('display'); assertFalse("Node should be hidden but vas visible: " + sortedHtml(node), isVisible(node)); } function assertVisible(node) { assertTrue("Node should be visible but vas hidden: " + sortedHtml(node), isVisible(node)); } function assertJsonEquals(expected, actual) { assertEquals(toJson(expected), toJson(actual)); } function assertUndefined(value) { assertEquals('undefined', typeof value); } function assertDefined(value) { assertTrue(toJson(value), !!value); } function assertThrows(error, fn){ var exception = null; try { fn(); } catch(e) { exception = e; } if (!exception) { fail("Expecting exception, none thrown"); } assertEquals(error, exception); } log = noop; error = noop;