diff --git a/app/assets/stylesheets/buttons.scss b/app/assets/stylesheets/buttons.scss
index b3522df4..6117f6ab 100644
--- a/app/assets/stylesheets/buttons.scss
+++ b/app/assets/stylesheets/buttons.scss
@@ -8,4 +8,5 @@
color: $white;
padding: 8px 16px;
border: 0px;
+ text-decoration: none;
}
diff --git a/app/presenters/category_presenter.rb b/app/presenters/category_presenter.rb
index 99c1f4d6..273dbdc2 100644
--- a/app/presenters/category_presenter.rb
+++ b/app/presenters/category_presenter.rb
@@ -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'
diff --git a/app/views/dashboard/_quality_framework_indicators.erb b/app/views/dashboard/_quality_framework_indicators.erb
index 5b2fb827..080998dc 100644
--- a/app/views/dashboard/_quality_framework_indicators.erb
+++ b/app/views/dashboard/_quality_framework_indicators.erb
@@ -2,7 +2,7 @@
<% category_presenters.each do |category_presenter| %>
-
-
+
+ <%= link_to [@district, @school, category_presenter.category, { year: @academic_year.range }], id: category_presenter.id, class: ["view-details", "mt-3"] do %>View Details<% end %>
+
<% end %>
diff --git a/spec/features/school_dashboard_feature_spec.rb b/spec/features/school_dashboard_feature_spec.rb
index b7dab844..023ba3ac 100644
--- a/spec/features/school_dashboard_feature_spec.rb
+++ b/spec/features/school_dashboard_feature_spec.rb
@@ -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
diff --git a/spec/presenters/category_presenter_spec.rb b/spec/presenters/category_presenter_spec.rb
index 487c1e60..cda78d04 100644
--- a/spec/presenters/category_presenter_spec.rb
+++ b/spec/presenters/category_presenter_spec.rb
@@ -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
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 8dc7f1f4..f9999291 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -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