Skip to content
This repository has been archived by the owner on Dec 23, 2017. It is now read-only.

Commit

Permalink
Merge pull request #477 from jmcarp/feature/new-styles
Browse files Browse the repository at this point in the history
Feature/new styles
  • Loading branch information
Noah Manger committed Aug 17, 2015
2 parents 84b8b70 + 5454535 commit dcc9e9a
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 59 deletions.
2 changes: 1 addition & 1 deletion templates/macros/filters/date.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% macro field(name, label, dates) %}

<div class="filter date-choice-field tst-filter" id="{{ name }}">
<div class="filter date-choice-field" id="{{ name }}">
<label for="{{ name }}" class="label">{{ label }}</label>
<ul>
<li>
Expand Down
4 changes: 2 additions & 2 deletions templates/macros/filters/states.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% macro field(name='name') %}
<div class="filter tst-filter">
<div class="filter">
<fieldset class="js-checkbox-filters">
<legend class="label" for="state">State or Territory</legend>
<ul class="dropdown__selected"></ul>
Expand All @@ -18,4 +18,4 @@
</div>
</fieldset>
</div>
{% endmacro %}
{% endmacro %}
2 changes: 1 addition & 1 deletion templates/macros/filters/text.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% macro field(name, title, attrs={}) %}
<div class="filter tst-filter" id="{{ name }}-field">
<div class="filter" id="{{ name }}-field">
<label class="label" for="{{ name }}">{{ title }}</label>
<div class="input--removable">
<input type="text" name="{{ name }}"
Expand Down
2 changes: 1 addition & 1 deletion templates/partials/filters/amendment-indicator.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="filter tst-filter">
<div class="filter">
<fieldset class="js-checkbox-filters">
<legend class="label" for="amendment-dropdown">Amendment Indicator<span class="any" aria-hidden="true">(Any)</span></legend>
<ul class="dropdown__selected">
Expand Down
30 changes: 15 additions & 15 deletions templates/partials/filters/committee-types.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="filter tst-filter">
<div class="filter">
<fieldset class="js-checkbox-filters">
<legend class="label" for="committee_type">Authorized Committees</legend>
<ul class="dropdown__selected">
Expand All @@ -9,31 +9,31 @@
<li>
<input id="committee-type-checkbox-S" type="checkbox" name="committee_type" value="S">
<label class="dropdown__value" for="committee-type-checkbox-S">Senate</label>
</li>
</li>
<li>
<input id="committee-type-checkbox-H" type="checkbox" name="committee_type" value="H">
<label class="dropdown__value" for="committee-type-checkbox-H">House</label>
</li>
</li>
</ul>
</fieldset>
</div>

<div class="filter tst-filter">
<div class="filter">
<fieldset class="js-checkbox-filters">
<legend class="label" for="committee_type">PACs</legend>
<ul class="dropdown__selected"></ul>
<div class="dropdown">
<button class="js-toggle js-dropdown button--dropdown button--neutral" data-toggles="pac-dropdown" >More</button>
<div id="pac-dropdown" class="dropdown__panel" aria-hidden="true">
<ul class="dropdown__list">
<ul class="dropdown__list">
<li>
<input id="designation-checkbox-B" type="checkbox" name="designation" value="B">
<label class="dropdown__value" for="designation-checkbox-B">Lobbyist/Registrant PAC</label>
</li>
<li>
<input id="designation-checkbox-D" type="checkbox" name="designation" value="D">
<label class="dropdown__value" for="designation-checkbox-D">Leadership PAC</label>
</li>
</li>
<li>
<input id="committee-type-checkbox-N" type="checkbox" name="committee_type" value="N">
<label class="dropdown__value" for="committee-type-checkbox-N">PAC - Nonqualified</label>
Expand Down Expand Up @@ -74,21 +74,21 @@
<li>
<input id="org-type-checkbox-W" name="organization_type" type="checkbox" value="W">
<label class="dropdown__value" for="org-type-checkbox-W">Corporation Without Capital Stock</label>
</li>
</li>
</ul>
</div>
</fieldset>
</div>


<div class="filter tst-filter">
<div class="filter">
<fieldset class="js-checkbox-filters">
<legend class="label" for="committee_type">Other Committees</legend>
<ul class="dropdown__selected">
<li>
<input id="designation-checkbox-J" type="checkbox" name="designation" value="J">
<label class="dropdown__value" for="designation-checkbox-J">Joint fundraising committee</label>
</li>
</li>
</ul>
<div class="dropdown">
<button class="js-toggle js-dropdown button--dropdown button--neutral" data-toggles="other-dropdown">More</button>
Expand All @@ -105,7 +105,7 @@
<li>
<input id="committee-type-checkbox-E" type="checkbox" name="committee_type" value="E">
<label class="dropdown__value" for="committee-type-checkbox-E">Electioneering Communication</label>
</li>
</li>
<li>
<input id="committee-type-checkbox-X" type="checkbox" name="committee_type" value="X">
<label class="dropdown__value" for="committee-type-checkbox-X">Party - Nonqualified</label>
Expand All @@ -117,20 +117,20 @@
<li>
<input id="committee-type-checkbox-Z" type="checkbox" name="committee_type" value="Z">
<label class="dropdown__value" for="committee-type-checkbox-Z">National Party Nonfederal Account</label>
</li>
</li>
</ul>
</div>
</fieldset>
</div>

<div class="filter tst-filter">
<div class="filter">
<fieldset class="js-checkbox-filters">
<legend class="label" for="committee_type">Independent Expenditure Committees</legend>
<ul class="dropdown__selected">
<li>
<input id="committee-type-checkbox-O" type="checkbox" name="committee_type" value="O">
<label class="dropdown__value" for="committee-type-checkbox-O">Super PAC (Independent Expenditure-Only)</label>
</li>
</li>
</ul>
<div class="dropdown">
<button class="js-toggle js-dropdown button--dropdown button--neutral" data-toggles="ie-dropdown" >More</button>
Expand All @@ -143,9 +143,9 @@
<li>
<input id="committee-type-checkbox-I" type="checkbox" name="committee_type" value="I">
<label class="dropdown__value" for="committee-type-checkbox-I">Independent Expenditor (Person or Group)</label>
</li>
</li>
</ul>
</div>
</div>
</fieldset>
</div>
</div>
4 changes: 2 additions & 2 deletions templates/partials/filters/districts.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="filter tst-filter">
<div class="filter">
<fieldset class="js-checkbox-filters">
<legend class="label" for="district">District</legend>
<ul class="dropdown__selected"></ul>
Expand All @@ -19,6 +19,6 @@
{% endfor %}
</ul>
</div>
</div>
</div>
</fieldset>
</div>
2 changes: 1 addition & 1 deletion templates/partials/filters/election-years.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="filter tst-filter">
<div class="filter">
<fieldset class="js-checkbox-filters">
<legend class="label">Election Years</legend>
<ul class="dropdown__selected"></ul>
Expand Down
2 changes: 1 addition & 1 deletion templates/partials/filters/office-sought.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="filter tst-filter">
<div class="filter">
<fieldset class="js-checkbox-filters">
<legend class="label" for="office">Office Sought</legend>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion templates/partials/filters/parties.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="filter tst-filter">
<div class="filter">
<fieldset class="js-checkbox-filters">
<legend class="label" for="party">Political Party <span class="any" aria-hidden="true">(Any)</span></legend>
<ul class="dropdown__selected">
Expand Down
4 changes: 2 additions & 2 deletions templates/partials/filters/primary-general.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="filter tst-filter">
<div class="filter">
<fieldset>
<legend class="label">Election Type</legend>
<ul>
Expand All @@ -16,4 +16,4 @@
</li>
</ul>
</fieldset>
</div>
</div>
2 changes: 1 addition & 1 deletion templates/partials/filters/report-type.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="filter tst-filter">
<div class="filter">
<label for="report_type" class="label">Report Type<span class="any" aria-hidden="true">(Any)</span></label>
<fieldset class="js-checkbox-filters">
<ul class="dropdown__selected"></ul>
Expand Down
2 changes: 1 addition & 1 deletion templates/partials/search-results-committee.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</div>
<div class="entity__term entity__term--aligned">
<h5 class="entity__term__data">
<a title="{{ committee.name }}"
<a class="tst-result-link" title="{{ committee.name }}"
href="{{ url_for('committee_page', c_id=committee.committee_id) }}">
{{ committee.name }}
</a>
Expand Down
6 changes: 4 additions & 2 deletions tests/selenium/base_test_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,13 @@ def check_filter(self, name, value, column, result, refresh=True, expand=True):
def click_filter(self, name, value, expand=True):
div = self.driver.find_element_by_xpath(''.join([
'//*[@name="' + name + '"]',
'/ancestor::div[@class="tst-filter"]',
'/ancestor::fieldset',
'/parent::div[contains(@class, "filter")]',
]))
checkbox = div.find_element_by_css_selector(
'input[type="checkbox"][value="' + value + '"]'
)
label = checkbox.find_element_by_xpath('following-sibling::label')
# Ensure performance bar doesn't block clicks
self.driver.execute_script('$(".perfBar-bar").hide()')
if expand:
Expand All @@ -130,7 +132,7 @@ def click_filter(self, name, value, expand=True):
# Handle probabilistic checkbox click failures in Chrome
checked = bool(checkbox.get_attribute('checked'))
utils.try_until(
lambda: checkbox.click(),
lambda: label.click(),
condition=lambda: bool(checkbox.get_attribute('checked')) != checked,
)

Expand Down
4 changes: 3 additions & 1 deletion tests/selenium/committees_list_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ def setUp(self):

def testCommitteesPageLoads(self):
self.driver.get(self.url)
self.assertEqual(self.driver.find_element_by_tag_class('tst-page-title').text, 'Committees')
self.assertEqual(
self.driver.find_element_by_class_name('tst-page-title').text,
'Committees')

def testCommitteesFilterSideBar(self):
self.driver.get(self.url)
Expand Down
6 changes: 3 additions & 3 deletions tests/selenium/error_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def testErrorPageLoads(self):
def testErrorPageSearch(self):
self.driver.get(self.url)
main = self.driver.find_element_by_tag_name('main')
main.find_element_by_class_name('search-input').send_keys('obama')
main.find_element_by_class_name('search-submit').click()
main.find_element_by_class_name('js-search-input').send_keys('obama')
main.find_element_by_class_name('button--primary').click()

self.elementExistsByClassName('tst-search_results')
self.elementExistsByClassName('tst-search_results')
4 changes: 2 additions & 2 deletions tests/selenium/landing_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def testLandingPageLoads(self):
def testMainSearch(self):
self.driver.get(self.url)
main = self.getMain()
main.find_element_by_class_name('tst-search-input').send_keys('obama')
main.find_element_by_class_name('tst-search-submit').click()
main.find_element_by_class_name('js-search-input').send_keys('obama')
main.find_element_by_class_name('button--primary').click()
self.elementExistsByClassName('tst-search_results')

def testGlossaryToggle(self):
Expand Down
22 changes: 0 additions & 22 deletions tests/selenium/search_results_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,3 @@ def test_search_results_page_link_committees(self):
committee_url_re.search(elm.get_attribute('href'))
for elm in elms
]))

def test_typeahead_from_candidates_page(self):
self.url.path.add('candidates')
self.driver.get(self.url.url)
select = self.driver.find_element_by_css_selector('input[value="candidates"]')
self.assertEqual(select.get_attribute('checked'), 'true')
self.driver.find_element_by_css_selector(
'.tst-search-input'
).send_keys(self.candidate)
results = self.driver.find_elements_by_css_selector('.tt-suggestion')
self.assertGreater(len(results), 0)

def test_typeahead_from_committees_page(self):
self.url.path.add('committees')
self.driver.get(self.url.url)
select = self.driver.find_element_by_css_selector('input[value="committees"]')
self.assertEqual(select.get_attribute('checked'), 'true')
self.driver.find_element_by_css_selector(
'.tst-search-input'
).send_keys(self.committee)
results = self.driver.find_elements_by_css_selector('.tt-suggestion')
self.assertGreater(len(results), 0)

0 comments on commit dcc9e9a

Please sign in to comment.