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>')
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>')
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>')
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>')
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>')
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>')
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>')
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>')
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>')
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>')
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>')
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>')
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>')
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>')
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>')
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>')
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>')
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>')
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>')
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>')
def test_0(self): """ Rendering return an empty string """ with self.app.test_request_context(): assert_equal(cvr(self.simple()), '')
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}}">')
def test_1(self): with self.app.test_request_context(): widget = Nowidget('bind', required=True) assert_equal(cvr(widget()), '')
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>')