Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated view, plugin, and tests to accomodate the cancel button.

  - wrote initial test descriptions for cancel button
  • Loading branch information...
commit b4a64c7a44ffec993dea9a8f62dcc7c1eba141c7 1 parent 702f38f
Marc Ignacio padi authored padi committed
2  app/assets/javascripts/story_filter.js
View
@@ -4,7 +4,7 @@
ENTER: 13
};
- var input = this;
+ var input = this.find('input#filter_bar');
input.keydown(function(event) {
if(event.keyCode == KEYCODES.ENTER) {
2  app/views/projects/show.html.erb
View
@@ -113,7 +113,7 @@ $(function() {
<%= render :partial => 'projects/nav',
:locals => {:project => @project, :show_column_toggles => true} %>
| <a id="add_story" href="#">Add story</a>
- | <input id="filter_bar" placeholder="Filter stories..." />
+ | <div id="filter"><input id="filter_bar" placeholder="Filter stories..." /><span id="cancel"></span></div>
<% end %>
<table class="stories" width="100%">
25 spec/javascripts/story_filter.spec.js
View
@@ -9,19 +9,21 @@ describe("filtering stories", function() {
var story1, story2;
beforeEach(function() {
- main_container = $('<div></div>');
-
- input = $('<input id="filter_bar" placeholder="Filter stories..." />');
+ filter_container = $('<div id="filter"></div>');
+ input = $('<input id="filter_bar" placeholder="Filter stories..." />');
+ cancel = $('<span id="cancel"></span>');
+ filter_container.append(input).append(cancel);
storiesTable = $('<table class="stories"></table>');
story1 = $('<div id="1" class="story"><div class="story-title">Story with first keyword</div></div>');
story2 = $('<div id="2" class="story"><div class="story-title">Story with second keyword</div></div>');
-
storiesTable.append(story1).append(story2);
- main_container.append(input).append(storiesTable);
+
+ main_container = $('<div></div>');
+ main_container.append(filter_container).append(storiesTable);
setFixtures(main_container);
- input.filterStories();
+ filter_container.filterStories();
});
describe("filtering stories based on keywords", function() {
@@ -61,5 +63,16 @@ describe("filtering stories", function() {
expect(story2).not.toBeVisible();
});
});
+
+ describe("cancel", function() {
+ xit("should not appear when filter bar is empty", function() {
+ });
+
+ xit("should appear when there are keywords inside the filter bar", function() {
+ });
+
+ xit("should empty the filterbar when clicked", function() {
+ });
+ });
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.