Added integration tests for listviews. These tests mock a users interaction with the various listviews, checking that the page is both enhanced and that the navigation behaves as expected.

This commit is contained in:
Jesse Streb 2010-12-23 09:47:48 -05:00
parent e9b076bcc0
commit 015a361eb1
7 changed files with 3299 additions and 0 deletions

20
external/jasmine-1.0.1/MIT.LICENSE vendored Normal file
View file

@ -0,0 +1,20 @@
Copyright (c) 2008-2010 Pivotal Labs
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

188
external/jasmine-1.0.1/jasmine-html.js vendored Normal file
View file

@ -0,0 +1,188 @@
jasmine.TrivialReporter = function(doc) {
this.document = doc || document;
this.suiteDivs = {};
this.logRunningSpecs = false;
};
jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
var el = document.createElement(type);
for (var i = 2; i < arguments.length; i++) {
var child = arguments[i];
if (typeof child === 'string') {
el.appendChild(document.createTextNode(child));
} else {
if (child) { el.appendChild(child); }
}
}
for (var attr in attrs) {
if (attr == "className") {
el[attr] = attrs[attr];
} else {
el.setAttribute(attr, attrs[attr]);
}
}
return el;
};
jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
var showPassed, showSkipped;
this.outerDiv = this.createDom('div', { className: 'jasmine_reporter' },
this.createDom('div', { className: 'banner' },
this.createDom('div', { className: 'logo' },
this.createDom('a', { href: 'http://pivotal.github.com/jasmine/', target: "_blank" }, "Jasmine"),
this.createDom('span', { className: 'version' }, runner.env.versionString())),
this.createDom('div', { className: 'options' },
"Show ",
showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),
this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),
showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),
this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")
)
),
this.runnerDiv = this.createDom('div', { className: 'runner running' },
this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),
this.runnerMessageSpan = this.createDom('span', {}, "Running..."),
this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, ""))
);
this.document.body.appendChild(this.outerDiv);
var suites = runner.suites();
for (var i = 0; i < suites.length; i++) {
var suite = suites[i];
var suiteDiv = this.createDom('div', { className: 'suite' },
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
this.suiteDivs[suite.id] = suiteDiv;
var parentDiv = this.outerDiv;
if (suite.parentSuite) {
parentDiv = this.suiteDivs[suite.parentSuite.id];
}
parentDiv.appendChild(suiteDiv);
}
this.startedAt = new Date();
var self = this;
showPassed.onclick = function(evt) {
if (showPassed.checked) {
self.outerDiv.className += ' show-passed';
} else {
self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');
}
};
showSkipped.onclick = function(evt) {
if (showSkipped.checked) {
self.outerDiv.className += ' show-skipped';
} else {
self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');
}
};
};
jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
var results = runner.results();
var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
this.runnerDiv.setAttribute("class", className);
//do it twice for IE
this.runnerDiv.setAttribute("className", className);
var specs = runner.specs();
var specCount = 0;
for (var i = 0; i < specs.length; i++) {
if (this.specFilter(specs[i])) {
specCount++;
}
}
var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild);
this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString()));
};
jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
var results = suite.results();
var status = results.passed() ? 'passed' : 'failed';
if (results.totalCount == 0) { // todo: change this to check results.skipped
status = 'skipped';
}
this.suiteDivs[suite.id].className += " " + status;
};
jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) {
if (this.logRunningSpecs) {
this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
}
};
jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
var results = spec.results();
var status = results.passed() ? 'passed' : 'failed';
if (results.skipped) {
status = 'skipped';
}
var specDiv = this.createDom('div', { className: 'spec ' + status },
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
this.createDom('a', {
className: 'description',
href: '?spec=' + encodeURIComponent(spec.getFullName()),
title: spec.getFullName()
}, spec.description));
var resultItems = results.getItems();
var messagesDiv = this.createDom('div', { className: 'messages' });
for (var i = 0; i < resultItems.length; i++) {
var result = resultItems[i];
if (result.type == 'log') {
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
} else if (result.type == 'expect' && result.passed && !result.passed()) {
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
if (result.trace.stack) {
messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
}
}
}
if (messagesDiv.childNodes.length > 0) {
specDiv.appendChild(messagesDiv);
}
this.suiteDivs[spec.suite.id].appendChild(specDiv);
};
jasmine.TrivialReporter.prototype.log = function() {
var console = jasmine.getGlobal().console;
if (console && console.log) {
if (console.log.apply) {
console.log.apply(console, arguments);
} else {
console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
}
}
};
jasmine.TrivialReporter.prototype.getLocation = function() {
return this.document.location;
};
jasmine.TrivialReporter.prototype.specFilter = function(spec) {
var paramMap = {};
var params = this.getLocation().search.substring(1).split('&');
for (var i = 0; i < params.length; i++) {
var p = params[i].split('=');
paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
}
if (!paramMap["spec"]) return true;
return spec.getFullName().indexOf(paramMap["spec"]) == 0;
};

166
external/jasmine-1.0.1/jasmine.css vendored Normal file
View file

@ -0,0 +1,166 @@
body {
font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif;
}
.jasmine_reporter a:visited, .jasmine_reporter a {
color: #303;
}
.jasmine_reporter a:hover, .jasmine_reporter a:active {
color: blue;
}
.run_spec {
float:right;
padding-right: 5px;
font-size: .8em;
text-decoration: none;
}
.jasmine_reporter {
margin: 0 5px;
}
.banner {
color: #303;
background-color: #fef;
padding: 5px;
}
.logo {
float: left;
font-size: 1.1em;
padding-left: 5px;
}
.logo .version {
font-size: .6em;
padding-left: 1em;
}
.runner.running {
background-color: yellow;
}
.options {
text-align: right;
font-size: .8em;
}
.suite {
border: 1px outset gray;
margin: 5px 0;
padding-left: 1em;
}
.suite .suite {
margin: 5px;
}
.suite.passed {
background-color: #dfd;
}
.suite.failed {
background-color: #fdd;
}
.spec {
margin: 5px;
padding-left: 1em;
clear: both;
}
.spec.failed, .spec.passed, .spec.skipped {
padding-bottom: 5px;
border: 1px solid gray;
}
.spec.failed {
background-color: #fbb;
border-color: red;
}
.spec.passed {
background-color: #bfb;
border-color: green;
}
.spec.skipped {
background-color: #bbb;
}
.messages {
border-left: 1px dashed gray;
padding-left: 1em;
padding-right: 1em;
}
.passed {
background-color: #cfc;
display: none;
}
.failed {
background-color: #fbb;
}
.skipped {
color: #777;
background-color: #eee;
display: none;
}
/*.resultMessage {*/
/*white-space: pre;*/
/*}*/
.resultMessage span.result {
display: block;
line-height: 2em;
color: black;
}
.resultMessage .mismatch {
color: black;
}
.stackTrace {
white-space: pre;
font-size: .8em;
margin-left: 10px;
max-height: 5em;
overflow: auto;
border: 1px inset red;
padding: 1em;
background: #eef;
}
.finished-at {
padding-left: 1em;
font-size: .6em;
}
.show-passed .passed,
.show-skipped .skipped {
display: block;
}
#jasmine_content {
position:fixed;
right: 100%;
}
.runner {
border: 1px solid gray;
display: block;
margin: 5px 0;
padding: 2px 0 2px 10px;
}

2421
external/jasmine-1.0.1/jasmine.js vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,49 @@
/*function basicListViewHTML() {
var html = '<ul data-role="listview" data-theme="g">\
<li><a href="acura.html">Acura</a></li>\
<li><a href="audi.html">Audi</a></li>\
<li><a href="bmw.html">BMW</a></li>\
</ul>';
return html;
}*/
var listViewHelper = {};
(function ($, lvh, undefined ) {
var current_page
, pageShowFired = false;
lvh.resetForPage = function(new_page) {
//remove any old event listeners from the current page if defined
if(current_page)
current_page.die('pageshow', lvh.pageshowHandler);
pageShowFired = false;
current_page = new_page;
current_page.live('pageshow', lvh.pageshowHandler);
}
lvh.currentPage = function() {
return current_page;
}
lvh.transitionComplete = function() {
return pageShowFired;
}
lvh.pageshowHandler = function() {
pageShowFired = true;
}
lvh.showResultsWhenComplete = function() {
if($('.jasmine_reporter .running').length == 0) {
$('.ui-page-active').css('display', 'none');
} else {
setTimeout(lvh.showResultsWhenComplete, 500);
}
}
setTimeout(lvh.showResultsWhenComplete, 500);
})(jQuery, listViewHelper)

View file

@ -0,0 +1,175 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Integration Test Runner</title>
<link rel="stylesheet" href="../../themes/default" />
<script type="text/javascript" src="../../js/"></script>
<link rel="stylesheet" type="text/css" href="../../external/jasmine-1.0.1/jasmine.css">
<script type="text/javascript" src="../../external/jasmine-1.0.1/jasmine.js"></script>
<script type="text/javascript" src="../../external/jasmine-1.0.1/jasmine-html.js"></script>
<script type="text/javascript" src="./helpers/spec_helpers.js"></script>
<!-- include source files here... -->
<!-- include spec files here... -->
<script type="text/javascript" src="specs/ListviewSpec.js"></script>
</head>
<body>
<script type="text/javascript">
jasmine.getEnv().addReporter(new jasmine.TrivialReporter());
jasmine.getEnv().execute();
</script>
<!-- Basic Linked view test -->
<div data-role="page" id='basic-linked-test'>
<div data-role="header" data-position="inline">
<h1>Basic List View</h1>
</div>
<div data-role="content">
<ul data-role="listview">
<li><a href="#basic-link-results">Home</a></li>
<li><a href="#basic-link-results">Back</a></li>
<li><a href="#basic-link-results">Return</a></li>
</ul>
</div>
</div>
<div data-role='page' id='basic-link-results'>
<div data-role="header" data-position="inline">
<h1>Results</h1>
</div>
</div>
<!-- Nested List -->
<div data-role="page" id='nested-list-test'>
<div data-role="header" data-position="inline">
<h1>Basic List View</h1>
</div>
<div data-role="content">
<ul data-role="listview">
<li>Groups of animals
<ul>
<li>pod of whales</li>
<li>quiver of cobras</li>
<li>troop of baboons</li>
</ul>
</li>
<li>More animals
<ul>
<li>Shoal of Bass</li>
<li>Rhumba of rattlesnakes</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- Numbered List -->
<div data-role="page" id='numbered-list-test'>
<div data-role="header" data-position="inline">
<h1>Basic List View</h1>
</div>
<div data-role="content">
<ol data-role="listview">
<li><a href="#numbered-list-results">Number 1</a></li>
<li><a href="#numbered-list-results">Number 2</a></li>
<li><a href="#numbered-list-results">Number 3</a></li>
</ol>
</div>
</div>
<div data-role='page' id='numbered-list-results'>
<div data-role="header" data-position="inline">
<h1>Numbered List</h1>
</div>
</div>
<!-- Read only List -->
<div data-role="page" id='read-only-list-test'>
<div data-role="header" data-position="inline">
<h1>Basic List View</h1>
</div>
<div data-role="content">
<ul data-role="listview">
<li>Read</li>
<li>Only</li>
<li>List</li>
<li>View</li>
</ul>
</div>
</div>
<!-- Split listview -->
<div data-role="page" id='split-list-test'>
<div data-role="header" data-position="inline">
<h1>Split List View</h1>
</div>
<div data-role="content">
<ul data-role="listview">
<li>
<a href="#split-list-link1">link one</a>
<a href="#split-list-link2">link second</a>
</li>
<li>
<a href="#split-list-link1">link one</a>
<a href="#split-list-link2">link second</a>
</li>
<li>
<a href="#split-list-link1">link one</a>
<a href="#split-list-link2">link second</a>
</li>
</ul>
</div>
</div>
<div data-role="page" id='split-list-link1'>
<div data-role="header" data-position="inline">
<h1>Split List view 1</h1>
</div>
</div>
<div data-role="page" id='split-list-link2'>
<div data-role="header" data-position="inline">
<h1>Split List view 2</h1>
</div>
</div>
<!-- List divider -->
<div data-role="page" id='list-divider-test'>
<div data-role="header" data-position="inline">
<h1>List Divider Test</h1>
</div>
<div data-role="content">
<ul data-role="listview">
<li>a is for aquaman</li>
<li>b is for batman</li>
<li data-role="list-divider">This is a list divider</li>
<li>c is for catwoman</li>
<li data-role="list-divider">This is another list divider</li>
<li>d is for darkwing</li>
</ul>
</div>
</div>
<!-- Search bar filter -->
<div data-role="page" id='search-filter-test'>
<div data-role="header" data-position="inline">
<h1>Split List View</h1>
</div>
<div data-role="content">
<ul data-role="listview" data-filter="true">
<li>a is for aquaman</li>
<li>b is for batman</li>
<li>c is for catwoman</li>
<li>d is for darkwing</li>
</ul>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,280 @@
describe("Listviews", function() {
describe("Basic Linked list", function() {
it("should setup the listview correctly", function() {
waitsFor(function() {
return ($('.ui-page-active').length > 0)
})
runs(function() {
expect($('.ui-page-active .ui-listview').length).toEqual(1);
expect($('.ui-page-active [role="option"]').length).toEqual(3);
})
});
it("should slide the listview page into view when the list view link is clicked", function() {
listViewHelper.resetForPage($('#basic-link-results'))
$('.ui-page-active li').first().click();
waitsFor(function() {
return listViewHelper.transitionComplete();
})
runs(function() {
expect(listViewHelper.currentPage().hasClass('ui-page-active')).toBeTruthy();
})
});
it("should slide back to the main page when the back button is clicked", function() {
listViewHelper.resetForPage($('#basic-linked-test'))
$('#basic-link-results a:contains("Back")').click();
waitsFor(function() {
return listViewHelper.transitionComplete();
})
runs(function() {
expect(listViewHelper.currentPage().hasClass('ui-page-active')).toBeTruthy();
});
});
});
describe("Nested List", function() {
it("should change the page to the nested list and make sure the page was enhanced.", function() {
listViewHelper.resetForPage($('#nested-list-test'))
location.href = "http://localhost:8888/tests/integration/runner.html#nested-list-test";
$.mobile.changePage(listViewHelper.currentPage());
waitsFor(function() {
return listViewHelper.transitionComplete();
})
runs(function() {
expect(listViewHelper.currentPage().hasClass('ui-page-active')).toBeTruthy();
expect($('[role="option"]', listViewHelper.currentPage()).length).toEqual(2);
expect($('body > [data-url="nested-list-test&ui-page=More-animals-0"]').length).toEqual(1);
expect($('body > [data-url="nested-list-test&ui-page=Groups-of-animals-1"]').length).toEqual(1);
});
});
it("should change to nested page when it is clicked", function() {
listViewHelper.resetForPage($('body > [data-url="nested-list-test&ui-page=More-animals-0"]'));
$('.ui-page-active li:eq(1)').click();
waitsFor(function() {
return listViewHelper.transitionComplete();
});
runs(function() {
expect(listViewHelper.currentPage().hasClass('ui-page-active')).toBeTruthy();
expect($('[role="option"]', listViewHelper.currentPage()).length).toEqual(2);
expect($('.ui-listview', listViewHelper.currentPage()).find(":contains('Rhumba of rattlesnakes')").length).toEqual(1);
expect($('.ui-listview', listViewHelper.currentPage()).find(":contains('Shoal of Bass')").length).toEqual(1);
});
});
it("should go back to top level when the back button is clicked", function() {
listViewHelper.resetForPage($('#nested-list-test'));
$('body > [data-url="nested-list-test&ui-page=More-animals-0"]').find('a:contains("Back")').click();
waitsFor(function() {
return listViewHelper.transitionComplete();
});
runs(function() {
expect(listViewHelper.currentPage().hasClass('ui-page-active')).toBeTruthy();
});
});
});
describe("Ordered Lists", function() {
it("should change the page to the numbered list and make sure the page was enhanced.", function() {
listViewHelper.resetForPage($('#numbered-list-test'));
location.href = "http://localhost:8888/tests/integration/runner.html#numbered-list-test";
$.mobile.changePage(listViewHelper.currentPage());
waitsFor(function() {
return listViewHelper.transitionComplete();
});
runs(function() {
expect(listViewHelper.currentPage().hasClass('ui-page-active')).toBeTruthy();
expect($('[role="option"]', listViewHelper.currentPage()).length).toEqual(3);
expect($('.ui-link-inherit', listViewHelper.currentPage()).first().text()).toEqual("Number 1");
});
});
it("should take us to number 1 page when click", function() {
listViewHelper.resetForPage($('#numbered-list-results'));
$('.ui-page-active li').first().click();
waitsFor(function() {
return listViewHelper.transitionComplete();
});
runs(function() {
expect(listViewHelper.currentPage().hasClass('ui-page-active')).toBeTruthy();
})
});
it("should slide back to the main numbered page when the back button is clicked", function() {
listViewHelper.resetForPage($('#numbered-list-test'));
$('.ui-page-active a:contains("Back")').click();
waitsFor(function() {
return listViewHelper.transitionComplete();
});
runs(function() {
expect(listViewHelper.currentPage().hasClass('ui-page-active')).toBeTruthy();
});
});
});
describe("read only list", function() {
it("should change the page to the Read only list and make sure the page was enhanced.", function() {
listViewHelper.resetForPage($('#read-only-list-test'));
location.href = "http://localhost:8888/tests/integration/runner.html#read-only-list-test";
$.mobile.changePage(listViewHelper.currentPage());
waitsFor(function() {
return listViewHelper.transitionComplete();
});
runs(function() {
expect(listViewHelper.currentPage().hasClass('ui-page-active')).toBeTruthy();
expect($('[role="option"]', listViewHelper.currentPage()).length).toEqual(4);
expect($('li', listViewHelper.currentPage()).first().text()).toEqual("Read");
});
});
it("should not take us to new page when a list item clicked", function() {
var current_page = $('#read-only-list-test');
$('li', current_page).first().click();
//wait a second to make sure that we give it time to transition if it is going to. It shouldn't
waits(1000);
runs(function() {
expect($('.ui-page-active').attr('id')).toEqual('read-only-list-test');
})
});
});
describe("split view list", function() {
it("should change the page to the split view and list view and enhance the page correctly.", function() {
listViewHelper.resetForPage($('#split-list-test'));
location.href = "http://localhost:8888/tests/integration/runner.html#split-list-test";
$.mobile.changePage(listViewHelper.currentPage());
waitsFor(function() {
return listViewHelper.transitionComplete();
});
runs(function() {
expect(listViewHelper.currentPage().hasClass('ui-page-active')).toBeTruthy();
expect($('[role="option"]', listViewHelper.currentPage()).length).toEqual(3);
expect($('.ui-li-link-alt', listViewHelper.currentPage()).length).toEqual(3);
expect($('.ui-link-inherit', listViewHelper.currentPage()).length).toEqual(3);
});
});
it("should change the page to split view page 1 when the first link is clicked", function() {
listViewHelper.resetForPage($('#split-list-link1'));
$('.ui-page-active [role="option"]:eq(0)').click();
waitsFor(function() {
return listViewHelper.transitionComplete();
});
runs(function() {
expect(listViewHelper.currentPage().hasClass('ui-page-active')).toBeTruthy();
});
});
it("should slide the page back to the split list view when the back button is clicked", function() {
listViewHelper.resetForPage($('#split-list-test'));
$('.ui-page-active a:contains("Back")').click();
waitsFor(function() {
return listViewHelper.transitionComplete();
});
runs(function() {
expect(listViewHelper.currentPage().hasClass('ui-page-active')).toBeTruthy();
});
});
/*
* Once the bug in which the changePage call does not update the hash correctly, resulting in the back button
* going back to the wrong page is fixed, then we should implement these tests.
*/
it("should slide to the second link when the right icon is clicked", function() {
//pending
})
it("should slide back to the split list view page when teh back button is clicked", function() {
//pending
});
});
describe("List dividers", function() {
it("should make the list divider page the active page and enhance it correctly.", function() {
listViewHelper.resetForPage($('#list-divider-test'));
location.href = "http://localhost:8888/tests/integration/runner.html#list-divider-test";
$.mobile.changePage(listViewHelper.currentPage());
waitsFor(function() {
return listViewHelper.transitionComplete();
});
runs(function() {
expect($('.ui-page-active .ui-li-divider').length).toEqual(2);
expect(listViewHelper.currentPage().hasClass('ui-page-active')).toBeTruthy();
});
});
});
describe("Search Filter", function() {
it("should make the search filter page the active page and enhance it correctly.", function() {
listViewHelper.resetForPage($('#search-filter-test'));
location.href = "http://localhost:8888/tests/integration/runner.html#search-filter-test";
$.mobile.changePage(listViewHelper.currentPage());
waitsFor(function() {
return listViewHelper.transitionComplete();
});
runs(function() {
expect($('.ui-page-active input').length).toEqual(1)
expect(listViewHelper.currentPage().hasClass('ui-page-active')).toBeTruthy();
});
});
it("should filter down the results when the user enters information", function() {
$('.ui-page-active input').val('at');
$('.ui-page-active input').trigger('change');
waitsFor(function() {
return $('.ui-page-active li[style="display: none; "]').length == 2;
})
runs(function() {
expect( $('.ui-page-active li[style="display: none; "]').length).toEqual(2);
});
});
it("if user removes values it should redisplay the results", function() {
$('.ui-page-active input').val('a')
$('.ui-page-active input').trigger('change');
waitsFor(function() {
return $('.ui-page-active li[style="display: none; "]').length == 0;
})
runs(function() {
expect( $('.ui-page-active li[style="display: none; "]').length).toEqual(0);
});
});
});
});