예제 #1
0
 def test_1(self):
     """
     pop-up simple rendering
     """
     simple = Datepicker('bind', popup=True)
     with self.app.test_request_context():
         assert_equal(cvr(simple()), '<input data-datepicker-popup="fullDate" data-is-open="_bind" data-ng-click="_bind != _bind;" data-ng-init="_bind = false;" data-ng-model="bind" type="text"></input>')
예제 #2
0
 def test_2(self):
     """
     controllable pop-up rendering
     """
     simple = Datepicker('bind', popup='control')
     with self.app.test_request_context():
         assert_equal(cvr(simple()), '<input data-datepicker-popup="fullDate" data-is-open="control" data-ng-click="control != control;" data-ng-model="bind" type="text"></input>')
예제 #3
0
 def test_0(self):
     """
     no pop-up simple rendering
     """
     simple = Datepicker('bind')
     with self.app.test_request_context():
         assert_equal(cvr(simple()), '<div data-datepicker data-ng-model="bind"></div>')
예제 #4
0
 def test_0(self):
     """
     simple rendering
     """
     with self.app.test_request_context():
         assert_equal(cvr(self.simple()),
                      '<input data-ng-model="bind" name="name" type="text">'
                      '</input>')
예제 #5
0
 def test_0(self):
     """
     simple rendering
     """
     with self.app.test_request_context():
         assert_equal(cvr(self.simple()),
                      '<textarea data-ng-model="bind" name="name">'
                      '</textarea>')
 def test_4(self):
     """
     Custom NumberInput arguments are processed and rendered : conditional required
     """
     with self.app.test_request_context():
         required = NumberInput('bind', name='name', required='angular')
         assert_equal(cvr(required()),
                      '<input data-ng-model="bind" data-ng-required="angular" name="name" type="number">'
                      '</input>')
 def test_3(self):
     """
     Custom NumberInput arguments are processed and rendered : simple required
     """
     with self.app.test_request_context():
         required = NumberInput('bind', name='name', required=True)
         assert_equal(cvr(required()),
                      '<input data-ng-model="bind" name="name" required type="number">'
                      '</input>')
 def test_14(self):
     """
     Custom NumberInput arguments are processed and rendered : max_length
     """
     with self.app.test_request_context():
         pattern = NumberInput('bind', name='name', max='10')
         assert_equal(cvr(pattern()),
                      '<input data-ng-model="bind" max="10" name="name" type="number">'
                      '</input>')
예제 #9
0
 def test_5(self):
     """
     Custom TextInput arguments are processed and rendered : pattern
     """
     with self.app.test_request_context():
         pattern = Textarea('bind', name='name', pattern='[A-Z]{5}')
         assert_equal(cvr(pattern()),
                      '<textarea data-ng-model="bind" data-ng-pattern="/[A-Z]{5}/" name="name">'
                      '</textarea>')
 def test_5(self):
     """
     Custom NumberInput arguments are processed and rendered : pattern
     """
     with self.app.test_request_context():
         pattern = NumberInput('bind', name='name', pattern='[0-9]{5}')
         assert_equal(cvr(pattern()),
                      '<input data-ng-model="bind" data-ng-pattern="/[0-9]{5}/" name="name" type="number">'
                      '</input>')
예제 #11
0
 def test_11(self):
     """
     Custom TextInput arguments are processed and rendered : pattern
     """
     with self.app.test_request_context():
         pattern = TextInput('bind', name='name', min_length='3')
         assert_equal(cvr(pattern()),
                      '<input data-ng-minlength="3" data-ng-model="bind" name="name" type="text">'
                      '</input>')
예제 #12
0
 def test_2(self):
     """
     Parameterized rendering is available.
     """
     with self.app.test_request_context():
         self.simple.bind = '{param}'
         assert_equal(cvr(self.simple(param='ok')),
                      '<textarea data-ng-model="ok" name="name">'
                      '</textarea>')
예제 #13
0
 def test_12(self):
     """
     Custom TextInput arguments are processed and rendered : pattern
     """
     with self.app.test_request_context():
         pattern = Textarea('bind', name='name', max_length='10')
         assert_equal(cvr(pattern()),
                      '<textarea data-ng-maxlength="10" data-ng-model="bind" name="name">'
                      '</textarea>')
예제 #14
0
 def test_3(self):
     """
     Custom TextInput arguments are processed and rendered : simple required
     """
     with self.app.test_request_context():
         required = Textarea('bind', name='name', required=True)
         assert_equal(cvr(required()),
                      '<textarea data-ng-model="bind" name="name" required>'
                      '</textarea>')
예제 #15
0
 def test_4(self):
     """
     Custom TextInput arguments are processed and rendered : conditional required
     """
     with self.app.test_request_context():
         required = Textarea('bind', name='name', required='angular')
         assert_equal(cvr(required()),
                      '<textarea data-ng-model="bind" data-ng-required="angular" name="name">'
                      '</textarea>')
예제 #16
0
 def test_1(self):
     """
     Modification of the widget's properties are reflected in the rendering.
     """
     with self.app.test_request_context():
         self.simple.bind = 'other'
         assert_equal(cvr(self.simple()),
                      '<textarea data-ng-model="other" name="name">'
                      '</textarea>')
예제 #17
0
 def test_7(self):
     """
     Custom HTML attribute can host simple angular expression
     """
     with self.app.test_request_context():
         attr = Textarea('bind', name='name',
                          html_attributes={'data-test': 'test|angular'})
         assert_equal(cvr(attr()),
                      '<textarea data-ng-model="bind" data-test="{{test}}" name="name">'
                      '</textarea>')
예제 #18
0
 def test_9(self):
     """
     Custom HTML attribute can be parameterized.
     """
     with self.app.test_request_context():
         attr = Textarea('bind', name='name',
                          html_attributes={'data-test': '{param}|angular'})
         assert_equal(cvr(attr(param='test')),
                      '<textarea data-ng-model="bind" data-test="{{test}}" name="name">'
                      '</textarea>')
예제 #19
0
 def test_8(self):
     """
     Custom HTML attribute can host complex angular expression
     """
     with self.app.test_request_context():
         attr = Textarea('bind', name='name',
                          html_attributes={'placeholder': 'function(a.nested.param, other)|angular'})
         assert_equal(cvr(attr()),
                      '<textarea data-ng-model="bind" name="name" placeholder="{{function(a.nested.param, other)}}">'
                      '</textarea>')
예제 #20
0
 def test_0(self):
     """
     simple angular select
     """
     with self.app.test_request_context():
         select = Select('bind', name='name',
                         options='label for value in array')
         assert_equal(cvr(select()),
                      '<select data-ng-model="bind" data-ng-options="label for value in array" name="name">'
                      '</select>')
 def test_6(self):
     """
     Custom HTML attribute are rendered
     """
     with self.app.test_request_context():
         attr = NumberInput('bind', name='name',
                          html_attributes={'data-test': 'test'})
         assert_equal(cvr(attr()),
                      '<input data-ng-model="bind" data-test="test" name="name" type="number">'
                      '</input>')
예제 #22
0
 def test_6(self):
     """
     Custom HTML attribute are rendered
     """
     with self.app.test_request_context():
         attr = Textarea('bind', name='name',
                          html_attributes={'data-test': 'test'})
         assert_equal(cvr(attr()),
                      '<textarea data-ng-model="bind" data-test="test" name="name">'
                      '</textarea>')
예제 #23
0
 def test_4(self):
     """
     Enable multiselect.
     """
     with self.app.test_request_context():
         select = Select('bind', name='name', multiple=True,
                         options='label for value in array')
         assert_equal(cvr(select()),
                      '<select data-ng-model="bind" data-ng-options="label for value in array" multiple name="name">'
                      '</select>')
예제 #24
0
    def test_10(self):
        """
        Custom HTML attribute can host complex parameterized angular expression
        """

        with self.app.test_request_context():
            attr = Textarea('bind', name='name',
                             html_attributes={'placeholder': 'function(a.nested.{param0}, {param1})|angular'})
            assert_equal(cvr(attr(param0='test', param1='success')),
                         '<textarea data-ng-model="bind" name="name" placeholder="{{function(a.nested.test, success)}}">'
                         '</textarea>')
예제 #25
0
 def test_2(self):
     """
     server-side option list with label and no group
     """
     with self.app.test_request_context():
         select = Select('bind', name='name',
                         options=[('choice0', 'value0'),
                                  ('choice1', 'value1'),
                                  ('choice2', 'value2'),
                                  ('choice3', 'value3'),
                                  ('choice4', 'value4')])
         assert_equal(cvr(select()),
                      '<select data-ng-model="bind" name="name">'
                      '<option value="value0">choice0</option>'
                      '<option value="value1">choice1</option>'
                      '<option value="value2">choice2</option>'
                      '<option value="value3">choice3</option>'
                      '<option value="value4">choice4</option>'
                      '</select>')
예제 #26
0
 def test_0(self):
     """
     Rendering return an empty string
     """
     with self.app.test_request_context():
         assert_equal(cvr(self.simple()), '')
예제 #27
0
 def test_0(self):
     """
     simple rendering
     """
     with self.app.test_request_context():
         assert_equal(cvr(self.simple()), '<input disabled name="name" type="text" value="{{bind}}">')
예제 #28
0
 def test_1(self):
     with self.app.test_request_context():
         widget = Nowidget('bind', required=True)
         assert_equal(cvr(widget()), '')
예제 #29
0
 def test_0(self):
     """
     simple rendering
     """
     with self.app.test_request_context():
         assert_equal(cvr(self.simple()), '<input data-ng-model="bind" data-typeahead="select as label for value in source" type="text"></input>')