Skip to content

Commit

Permalink
added visibility tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ArushC committed Apr 23, 2024
1 parent d0c8acf commit 698c894
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/teachers/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ which can result in inexplicable, and sometimes undefined behavior -->
debugger;
<%# For TEALS volunteer, we also ask for the name of their host teacher. %>
if (status_val == 3) {
$("#teacher-more-info-reminder").text("Please tell us why you need access, and include the name of your host teacher here.");
$('#upload_file_field').hide();
$("#teacher-more-info-reminder").text("Please tell us why you need access, and include the name of your host teacher here.");
} else {
$("#teacher-more-info-reminder").text("Please tell us why you need access.");
<%# If homeschool, then show upload file field %>
Expand Down
9 changes: 9 additions & 0 deletions features/form_submission.feature
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,15 @@ Feature: submit a form as a teacher
Then I should not see "Tags"
And I should not see "NCES ID"

Scenario: Upload file field visibility based on status option
Given I am on the BJC home page
And I set my status as "I am a TEALS volunteer, and am teaching the BJC curriculum."
Then the upload file field should be hidden
When I set my status as "I am teaching BJC as an AP CS Principles course."
Then the upload file field should be hidden
When I set my status as "I am teaching homeschool with the BJC curriculum."
Then the upload file field should be visible

Scenario: Teacher updates information and two emails are sent
Given the following schools exist:
| name | country | city | state | website | grade_level | school_type |
Expand Down
8 changes: 8 additions & 0 deletions features/step_definitions/teacher_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,11 @@
expect(Teacher.find_by(teacher_params).blank?).to be true
end
end

Then("the upload file field should be hidden") do
expect(page).to have_selector('#upload_file_field', visible: :hidden)
end

Then("the upload file field should be visible") do
expect(page).to have_selector('#upload_file_field', visible: :visible)
end
2 changes: 2 additions & 0 deletions spec/fixtures/test_file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This file only exists for the purposes of testing that
attaching files works
2 changes: 2 additions & 0 deletions spec/fixtures/test_file2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This file, likewise, only exists for the purposes of testing that
attaching files works

0 comments on commit 698c894

Please sign in to comment.