mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Display in the variance graph only those measures that have sufficient data
This commit is contained in:
parent
07b7561b55
commit
161db3bf3e
4 changed files with 40 additions and 15 deletions
|
|
@ -227,9 +227,7 @@ def district_admin_sees_dashboard_content
|
|||
district_admin_sees_student_physical_safety
|
||||
district_admin_sees_problem_solving_emphasis
|
||||
|
||||
expect(page).to have_css("[data-for-measure-id='3A-i'][width='0.0%']")
|
||||
|
||||
page.assert_selector('.measure-row-bar', count: Measure.count)
|
||||
page.assert_selector('.measure-row-bar', count: 5)
|
||||
|
||||
district_admin_sees_measures_in_correct_order
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe 'dashboard/index.html.erb' do
|
||||
subject { Nokogiri::HTML(rendered) }
|
||||
|
||||
let(:support_for_teaching) { create(:measure, name: 'Support For Teaching Development & Growth') }
|
||||
let(:effective_leadership) { create(:measure, name: 'Effective Leadership') }
|
||||
|
|
@ -13,11 +14,11 @@ describe 'dashboard/index.html.erb' do
|
|||
render
|
||||
end
|
||||
|
||||
context 'when there are measures for which, in the given academic year, the school has insufficient responses' do
|
||||
context 'when some presenters have a nil score' do
|
||||
let(:measure_graph_row_presenters) {
|
||||
[
|
||||
MeasureGraphRowPresenter.new(measure: support_for_teaching, score: nil),
|
||||
MeasureGraphRowPresenter.new(measure: create(:measure), score: rand),
|
||||
MeasureGraphRowPresenter.new(measure: create(:measure, name: 'Should Be Displayed', measure_id: 'should-be-displayed'), score: rand),
|
||||
MeasureGraphRowPresenter.new(measure: effective_leadership, score: nil),
|
||||
MeasureGraphRowPresenter.new(measure: professional_qualifications, score: nil)
|
||||
]
|
||||
|
|
@ -26,17 +27,37 @@ describe 'dashboard/index.html.erb' do
|
|||
it 'displays a note detailing which measures have insufficient responses for the given school & academic year' do
|
||||
expect(rendered).to match /Note: The following measures are not displayed due to limited availability of school admin data and\/or low survey response rates: Support For Teaching Development & Growth; Effective Leadership; Professional Qualifications./
|
||||
end
|
||||
|
||||
it 'displays a variance row and label only those presenters for which the score is not nil' do
|
||||
displayed_variance_rows = subject.css('[data-for-measure-id]')
|
||||
expect(displayed_variance_rows.count).to eq 1
|
||||
expect(displayed_variance_rows.first.attribute('data-for-measure-id').value).to eq 'should-be-displayed'
|
||||
|
||||
displayed_variance_labels = subject.css('[data-variance-row-label]')
|
||||
expect(displayed_variance_labels.count).to eq 1
|
||||
expect(displayed_variance_labels.first.inner_text).to include 'Should Be Displayed'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there are no measures for which, in the given academic year, the school has insufficient responses' do
|
||||
context 'when all the presenters have a non-nil score' do
|
||||
let(:measure_graph_row_presenters) {
|
||||
[
|
||||
MeasureGraphRowPresenter.new(measure: create(:measure), score: rand)
|
||||
MeasureGraphRowPresenter.new(measure: create(:measure, name: 'Display Me', measure_id: 'display-me'), score: rand)
|
||||
]
|
||||
}
|
||||
|
||||
it 'does not display a note detailing which measures have insufficient responses for the given school & academic year' do
|
||||
expect(rendered).not_to match /Note: The following measures are not displayed due to limited availability of school admin data and\/or low survey response rates/
|
||||
end
|
||||
|
||||
it 'displays a variance row for each presenter' do
|
||||
displayed_variance_rows = subject.css('[data-for-measure-id]')
|
||||
expect(displayed_variance_rows.count).to eq 1
|
||||
expect(displayed_variance_rows.first.attribute('data-for-measure-id').value).to eq 'display-me'
|
||||
|
||||
displayed_variance_labels = subject.css('[data-variance-row-label]')
|
||||
expect(displayed_variance_labels.count).to eq 1
|
||||
expect(displayed_variance_labels.first.inner_text).to include 'Display Me'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue