Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(749)

Unified Diff: test/test_browser_models.js

Issue 9003043: Adds filter controls to the search in the browser
Patch Set: Adds filter controls to the search in the browser Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/index.html ('k') | test/test_browser_search_view.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/test_browser_models.js
=== modified file 'test/test_browser_models.js'
--- test/test_browser_models.js 2013-03-07 20:27:06 +0000
+++ test/test_browser_models.js 2013-04-28 19:26:39 +0000
@@ -18,25 +18,16 @@
// Ensure the search results are rendered inside the container.
it('defaults to an initial filter set', function() {
var filter = new Filter();
- filter.get('category').should.eql([
- 'databases', 'file_servers', 'app_servers', 'cache_proxy',
- 'applications', 'miscellaneous']);
- filter.get('provider').should.eql(['aws', 'openstack']);
- filter.get('scope').should.eql(['public']);
filter.get('series').should.eql(['precise']);
filter.get('type').should.eql(['approved']);
});
it('constructs a valid query string based on settings.', function() {
var filter = new Filter();
- filter.genQueryString().should.equal([
- 'category=databases&category=file_servers&category=app_servers&',
- 'category=cache_proxy&category=applications&category=miscellaneous',
- '&provider=aws&provider=openstack&scope=public&series=precise&',
- 'type=approved'
- ].join(''));
+ filter.genQueryString().should.equal(
+ 'series=precise&text=&type=approved');
- filter.set('category', []);
+ filter.set('series', []);
// Google and Firefox think that the string should start with the first
// param. PhantomJS thinks it starts with a &. Removing the & if it's at
// the start of the string and checking the rest of it for validity.
@@ -45,10 +36,28 @@
qstring = qstring.slice(1);
}
- qstring.should.equal([
- 'provider=aws&provider=openstack&scope=public&',
- 'series=precise&type=approved'
- ].join(''));
+ qstring.should.equal('text=&type=approved');
+ });
+
+ it('updates string values into an array', function() {
+ var filter = new Filter({
+ text: 'one'
+ });
+
+ filter.update({category: 'databases'});
+ filter.get('category').should.eql(['databases']);
+ // While the text is left along
+ filter.get('text').should.eql('one');
+ });
+
+ it('updates text when empty', function() {
+ var filter = new Filter({
+ text: 'one'
+ });
+
+ filter.get('text').should.eql('one');
+ filter.update({text: ''});
+ filter.get('text').should.equal('');
});
});
« no previous file with comments | « test/index.html ('k') | test/test_browser_search_view.js » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b