Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding test case for deform #103 issue #16

Merged
merged 3 commits into from
Aug 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions deformdemo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,7 @@ class Schema(colander.Schema):
@view_config(renderer="templates/form.pt", name="autocomplete_input")
@demonstrate("Autocomplete Input Widget")
def autocomplete_input(self):

choices = ["bar", "baz", "two", "three"]
choices = ['bar', 'baz', 'two', 'three', 'foo & bar']
widget = deform.widget.AutocompleteInputWidget(
values=choices, min_length=1
)
Expand Down Expand Up @@ -2387,7 +2386,6 @@ def multiple_forms(self):
# forms do not overlap so accessibility features continue to work,
# such as focusing the field related to a legend when the
# legend is clicked on.

# We do so by creating an ``itertools.count`` object and
# passing that object as the ``counter`` keyword argument to
# the constructor of both forms. As a result, the second
Expand Down
10 changes: 10 additions & 0 deletions deformdemo/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2736,6 +2736,16 @@ def test_submit_filled(self):
# py2/py3 compat, py2 adds extra u prefix
self.assertTrue("bar" in text)

def test_special_chars(self):
findid('deformField1').send_keys('foo')
self.assertTrue(findxpath('//p[text()="foo & bar"]').is_displayed())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I type foo & bar in the input field, no text is displayed in the popup, so this test should fail, but it appears to pass.

findcss(".tt-suggestion").click()
findid("deformsubmit").click()
self.assertRaises(NoSuchElementException, findcss, ".has-error")
text = findid("captured").text
# py2/py3 compat, py2 adds extra u prefix
self.assertTrue("foo & bar" in text)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail because the output is:

{'text': 'foo '
         '& '
         'bar'}



class AutocompleteRemoteInputWidgetTests(Base, unittest.TestCase):
url = test_url("/autocomplete_remote_input/")
Expand Down