mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
SQM Indicators View Details button sends user to browse page [Finishes #179728459]
This commit is contained in:
parent
0d9474f2c0
commit
8f9d30a762
6 changed files with 58 additions and 22 deletions
|
|
@ -8,4 +8,5 @@
|
|||
color: $white;
|
||||
padding: 8px 16px;
|
||||
border: 0px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
class CategoryPresenter
|
||||
attr_reader :category
|
||||
|
||||
def initialize(category:, academic_year:, school:)
|
||||
@category = category
|
||||
@academic_year = academic_year
|
||||
|
|
@ -13,6 +15,10 @@ class CategoryPresenter
|
|||
@category.description
|
||||
end
|
||||
|
||||
def id
|
||||
@category.slug
|
||||
end
|
||||
|
||||
def icon
|
||||
case name
|
||||
when 'Teachers & Leadership'
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<div class="row mt-5">
|
||||
<% category_presenters.each do |category_presenter| %>
|
||||
<section class="category-card column d-flex flex-column justify-space-between align-items-center">
|
||||
<section id="<%= category_presenter.id %>" class="category-card column d-flex flex-column justify-space-between align-items-center">
|
||||
|
||||
<div class="category-card__icon">
|
||||
<i class="fa fa-<%= category_presenter.icon %> fa-2x color-gray-2"></i>
|
||||
|
|
@ -30,7 +30,9 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="category-card__button text-center"><button class="view-details mt-3">View Details</button></div>
|
||||
<div class="category-card__button text-center">
|
||||
<%= link_to [@district, @school, category_presenter.category, { year: @academic_year.range }], id: category_presenter.id, class: ["view-details", "mt-3"] do %>View Details<% end %>
|
||||
</div>
|
||||
</section>
|
||||
<% end %>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,27 +1,32 @@
|
|||
require 'rails_helper'
|
||||
# include Rails.application.routes.url_helpers
|
||||
|
||||
def row_for(measure_id:)
|
||||
expect(page).to have_css("[data-for-measure-id='#{measure_id}']")
|
||||
measure_row_bars.find { |item| item['data-for-measure-id'] == "#{measure_id}" }
|
||||
end
|
||||
|
||||
def district_admin_sees_professional_qualifications
|
||||
expect(page).to have_text('Professional Qualifications')
|
||||
professional_qualifications_row = row_for(measure_id: '1A-i')
|
||||
expect(professional_qualifications_row['width']).to eq '8.26%'
|
||||
expect(professional_qualifications_row['x']).to eq '60%'
|
||||
end
|
||||
|
||||
def district_admin_sees_student_physical_safety
|
||||
expect(page).to have_text('Student Physical Safety')
|
||||
student_physical_safety_row = measure_row_bars.find { |item| item['data-for-measure-id'] == '2A-i' }
|
||||
student_physical_safety_row = row_for(measure_id: '2A-i')
|
||||
expect(student_physical_safety_row['width']).to eq '40.0%'
|
||||
expect(student_physical_safety_row['x']).to eq '60%'
|
||||
end
|
||||
|
||||
def district_admin_sees_problem_solving_emphasis
|
||||
expect(page).to have_text('Problem Solving Emphasis')
|
||||
problem_solving_emphasis_row = measure_row_bars.find { |item| item['data-for-measure-id'] == '4C-i' }
|
||||
problem_solving_emphasis_row = row_for(measure_id: '4C-i')
|
||||
expect(problem_solving_emphasis_row['width']).to eq '60.0%'
|
||||
expect(problem_solving_emphasis_row['x']).to eq '0.0%'
|
||||
end
|
||||
|
||||
def district_admin_sees_professional_qualifications
|
||||
expect(page).to have_text('Professional Qualifications')
|
||||
professional_qualifications_row = measure_row_bars.find { |item| item['data-for-measure-id'] == '1A-i' }
|
||||
expect(professional_qualifications_row['width']).to eq '8.26%'
|
||||
expect(professional_qualifications_row['x']).to eq '60%'
|
||||
end
|
||||
|
||||
def go_to_school_dashboard_from_welcome_page(district, school)
|
||||
select district.name, from: 'district-dropdown'
|
||||
select school.name, from: 'school-dropdown'
|
||||
|
|
@ -47,11 +52,13 @@ def district_admin_sees_district_change
|
|||
end
|
||||
|
||||
def district_admin_sees_measures_in_correct_order
|
||||
professional_qualifications_row_index = measure_row_bars.find_index { |item| item['data-for-measure-id'] == '1A-i' }
|
||||
student_physical_safety_row_index = measure_row_bars.find_index { |item| item['data-for-measure-id'] == '2A-i' }
|
||||
problem_solving_emphasis_row_index = measure_row_bars.find_index { |item| item['data-for-measure-id'] == '4C-i' }
|
||||
expect(student_physical_safety_row_index).to be < professional_qualifications_row_index
|
||||
expect(professional_qualifications_row_index).to be < problem_solving_emphasis_row_index
|
||||
def index_of_row_for(measure_id:)
|
||||
expect(page).to have_css("[data-for-measure-id='#{measure_id}']")
|
||||
measure_row_bars.find_index { |item| item['data-for-measure-id'] == "#{measure_id}" }
|
||||
end
|
||||
|
||||
expect(index_of_row_for(measure_id: '2A-i')).to be < index_of_row_for(measure_id: '1A-i')
|
||||
expect(index_of_row_for(measure_id: '1A-i')).to be < index_of_row_for(measure_id: '4C-i')
|
||||
end
|
||||
|
||||
def district_admin_sees_dashboard_content
|
||||
|
|
@ -64,8 +71,7 @@ def district_admin_sees_dashboard_content
|
|||
district_admin_sees_student_physical_safety
|
||||
district_admin_sees_problem_solving_emphasis
|
||||
|
||||
measure_row_bar_with_no_responses = measure_row_bars.find { |item| item['data-for-measure-id'] == '3A-i' }
|
||||
expect(measure_row_bar_with_no_responses['width']).to eq '0.0%'
|
||||
expect(row_for(measure_id: '3A-i')['width']).to eq '0.0%'
|
||||
|
||||
page.assert_selector('.measure-row-bar', count: Measure.count)
|
||||
|
||||
|
|
@ -77,6 +83,10 @@ def district_admin_sees_browse_content
|
|||
expect(page).to have_text('Approval')
|
||||
end
|
||||
|
||||
def measure_row_bars
|
||||
page.all('rect.measure-row-bar')
|
||||
end
|
||||
|
||||
feature 'School dashboard', type: feature do
|
||||
let(:district) { District.find_by_slug 'winchester' }
|
||||
let(:different_district) { District.find_by_slug 'boston' }
|
||||
|
|
@ -100,8 +110,6 @@ feature 'School dashboard', type: feature do
|
|||
let(:survey_items_for_measure_2A_i) { SurveyItem.where(measure: measure_2A_i) }
|
||||
let(:survey_items_for_measure_4C_i) { SurveyItem.where(measure: measure_4C_i) }
|
||||
|
||||
let(:measure_row_bars) { page.all('rect.measure-row-bar') }
|
||||
|
||||
let(:ay_2020_21) { AcademicYear.find_by_range '2020-21' }
|
||||
|
||||
let(:username) { 'winchester' }
|
||||
|
|
@ -145,6 +153,14 @@ feature 'School dashboard', type: feature do
|
|||
|
||||
district_admin_sees_dashboard_content
|
||||
|
||||
within('section#school-culture') do
|
||||
expect(page).to have_text('View Details')
|
||||
click_on 'View Details'
|
||||
end
|
||||
district_admin_sees_browse_content
|
||||
click_on 'Dashboard'
|
||||
district_admin_sees_dashboard_content
|
||||
|
||||
click_on 'Browse'
|
||||
district_admin_sees_browse_content
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ describe CategoryPresenter do
|
|||
category = SqmCategory.find_by_name("School Culture")
|
||||
return CategoryPresenter.new(category: category, academic_year: AcademicYear.new, school: School.new)
|
||||
end
|
||||
|
||||
|
||||
let(:resources_presenter) do
|
||||
category = SqmCategory.find_by_name("Resources")
|
||||
return CategoryPresenter.new(category: category, academic_year: AcademicYear.new, school: School.new)
|
||||
|
|
@ -29,7 +29,7 @@ describe CategoryPresenter do
|
|||
return CategoryPresenter.new(category: category, academic_year: AcademicYear.new, school: School.new)
|
||||
end
|
||||
|
||||
let(:citizenship_and_wellbeing_presenter) do
|
||||
let(:citizenship_and_wellbeing_presenter) do
|
||||
category = SqmCategory.find_by_name("Citizenship & Wellbeing")
|
||||
return CategoryPresenter.new(category: category, academic_year: AcademicYear.new, school: School.new)
|
||||
end
|
||||
|
|
@ -49,7 +49,14 @@ describe CategoryPresenter do
|
|||
expect(resources_presenter.icon).to eq 'users-cog'
|
||||
expect(academic_learning_presenter.icon).to eq 'graduation-cap'
|
||||
expect(citizenship_and_wellbeing_presenter.icon).to eq 'heart'
|
||||
end
|
||||
|
||||
it 'returns the correct id for the given category' do
|
||||
expect(teachers_and_leadership_presenter.id).to eq 'teachers-and-leadership'
|
||||
expect(school_culture_presenter.id).to eq 'school-culture'
|
||||
expect(resources_presenter.id).to eq 'resources'
|
||||
expect(academic_learning_presenter.id).to eq 'academic-learning'
|
||||
expect(citizenship_and_wellbeing_presenter.id).to eq 'citizenship-and-wellbeing'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@ RSpec.configure do |config|
|
|||
Rails.application.load_seed # loading seeds
|
||||
end
|
||||
|
||||
config.before(:each, js: true) do
|
||||
Capybara.page.driver.resize(3000, 3000)
|
||||
end
|
||||
|
||||
# The settings below are suggested to provide a good initial experience
|
||||
# with RSpec, but feel free to customize to your heart's content.
|
||||
=begin
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue