Commit 36afbfbd by Ben McMorran Committed by cahrens

Add test for expand collapse while editing name

parent fbc886aa
......@@ -7,6 +7,7 @@ from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys
from .course_page import CoursePage
from .container import ContainerPage
......@@ -91,6 +92,13 @@ class CourseOutlineItem(object):
set_input_value_and_save(self, self._bounded_selector(self.NAME_INPUT_SELECTOR), new_name)
self.wait_for_ajax()
def finalize_name(self):
"""
Presses ENTER, saving the value of the display name for this item.
"""
self.q(css=self._bounded_selector(self.NAME_INPUT_SELECTOR)).results[0].send_keys(Keys.ENTER)
self.wait_for_ajax()
def in_editable_form(self):
"""
Return whether this outline item's display name is in its editable form.
......
......@@ -470,20 +470,25 @@ class EditNamesTest(CourseOutlineTest):
"""
Scenario: A section stays in the same expand/collapse state while its name is edited
Given that I have created a section
And the section is expanded
And the section is collapsed
When I click on the name of the section
Then the section is expanded
Then the section is collapsed
And given that I have entered a new name
Then the section is expanded
Then the section is collapsed
And given that I press ENTER to finalize the name
Then the section is collapsed
"""
self.course_outline_page.visit()
self.course_outline_page.section_at(0).toggle_expand()
self.assertFalse(self.course_outline_page.section_at(0).in_editable_form())
self.assertFalse(self.course_outline_page.section_at(0).is_collapsed)
self.assertTrue(self.course_outline_page.section_at(0).is_collapsed)
self.course_outline_page.section_at(0).edit_name()
self.assertTrue(self.course_outline_page.section_at(0).in_editable_form())
self.assertFalse(self.course_outline_page.section_at(0).is_collapsed)
self.assertTrue(self.course_outline_page.section_at(0).is_collapsed)
self.course_outline_page.section_at(0).enter_name('Changed')
self.assertFalse(self.course_outline_page.section_at(0).is_collapsed)
self.assertTrue(self.course_outline_page.section_at(0).is_collapsed)
self.course_outline_page.section_at(0).finalize_name()
self.assertTrue(self.course_outline_page.section_at(0).is_collapsed)
class CreateSectionsTest(CourseOutlineTest):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment