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(''); |
}); |
}); |