diff options
| author | Vandan Shah <vas@odoo.com> | 2017-10-09 18:10:07 +0530 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2018-08-20 21:11:54 +0200 |
| commit | f4ee61f950dc1eeb7b3653ca96ea72721512b5e5 (patch) | |
| tree | f220a194327bcea0fae2e03d536ab41d08e34011 /addons/web/static/tests/fields/basic_fields_tests.js | |
| parent | a7e94f1a83084d885694543fb9b9002acc50bb2d (diff) | |
[IMP] web: mobile: add swipe support in form views
This rev. allows to navigate, in mobile, through records in form
views by swiping.
We also moved mobile-specific tests involving a form view to the
mobile test suite, since those tests became async because of the
lazy loading of the swipe lib (in the mobile suite, that lib is
already loaded).
Related to task #34727
Co-authored-by: Mohammed Shekha <msh@openerp.com>
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
| -rw-r--r-- | addons/web/static/tests/fields/basic_fields_tests.js | 141 |
1 files changed, 2 insertions, 139 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index 68643f7b48d..4036594609f 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -3269,7 +3269,6 @@ QUnit.module('basic_fields', { list.destroy(); }); - QUnit.module('FieldFloatTime'); QUnit.test('float_time field in form view', function (assert) { @@ -3400,106 +3399,6 @@ QUnit.module('basic_fields', { QUnit.module('PhoneWidget'); - QUnit.test('phone field in form view on extra small screens', function (assert) { - assert.expect(7); - - var form = createView({ - View: FormView, - model: 'partner', - data: this.data, - arch:'<form string="Partners">' + - '<sheet>' + - '<group>' + - '<field name="foo" widget="phone"/>' + - '</group>' + - '</sheet>' + - '</form>', - res_id: 1, - config: { - device: { - size_class: config.device.SIZES.VSM, - }, - }, - }); - - var $phoneLink = form.$('a.o_form_uri.o_field_widget'); - assert.strictEqual($phoneLink.length, 1, - "should have a anchor with correct classes"); - assert.strictEqual($phoneLink.text(), 'yop', - "value should be displayed properly"); - assert.strictEqual($phoneLink.attr('href'), 'tel:yop', - "should have proper tel prefix"); - - // switch to edit mode and check the result - form.$buttons.find('.o_form_button_edit').click(); - assert.strictEqual(form.$('input[type="text"].o_field_widget').length, 1, - "should have an input for the phone field"); - assert.strictEqual(form.$('input[type="text"].o_field_widget').val(), 'yop', - "input should contain field value in edit mode"); - - // change value in edit mode - form.$('input[type="text"].o_field_widget').val('new').trigger('input'); - - // save - form.$buttons.find('.o_form_button_save').click(); - $phoneLink = form.$('a.o_form_uri.o_field_widget'); - assert.strictEqual($phoneLink.text(), 'new', - "new value should be displayed properly"); - assert.strictEqual($phoneLink.attr('href'), 'tel:new', - "should still have proper tel prefix"); - - form.destroy(); - }); - - QUnit.test('phone field in editable list view on extra small screens', function (assert) { - assert.expect(10); - - var list = createView({ - View: ListView, - model: 'partner', - data: this.data, - arch: '<tree editable="bottom"><field name="foo" widget="phone"/></tree>', - config: { - device: { - size_class: config.device.SIZES.VSM, - }, - }, - }); - - assert.strictEqual(list.$('tbody td:not(.o_list_record_selector)').length, 5, - "should have 5 cells"); - assert.strictEqual(list.$('tbody td:not(.o_list_record_selector)').first().text(), 'yop', - "value should be displayed properly"); - - var $phoneLink = list.$('a.o_form_uri.o_field_widget'); - assert.strictEqual($phoneLink.length, 5, - "should have anchors with correct classes"); - assert.strictEqual($phoneLink.first().attr('href'), 'tel:yop', - "should have proper tel prefix"); - - // Edit a line and check the result - var $cell = list.$('tbody td:not(.o_list_record_selector)').first(); - $cell.click(); - assert.ok($cell.parent().hasClass('o_selected_row'), 'should be set as edit mode'); - assert.strictEqual($cell.find('input').val(), 'yop', - 'should have the corect value in internal input'); - $cell.find('input').val('new').trigger('input'); - - // save - list.$buttons.find('.o_list_button_save').click(); - $cell = list.$('tbody td:not(.o_list_record_selector)').first(); - assert.ok(!$cell.parent().hasClass('o_selected_row'), 'should not be in edit mode anymore'); - assert.strictEqual(list.$('tbody td:not(.o_list_record_selector)').first().text(), 'new', - "value should be properly updated"); - $phoneLink = list.$('a.o_form_uri.o_field_widget'); - assert.strictEqual($phoneLink.length, 5, - "should still have anchors with correct classes"); - assert.strictEqual($phoneLink.first().attr('href'), 'tel:new', - "should still have proper tel prefix"); - - list.destroy(); - }); - QUnit.test('phone field in form view on normal screens', function (assert) { assert.expect(5); @@ -3517,7 +3416,7 @@ QUnit.module('basic_fields', { res_id: 1, config: { device: { - size_class: config.device.SIZES.MD, + size_class: config.device.SIZES.LG, }, }, }); @@ -3556,7 +3455,7 @@ QUnit.module('basic_fields', { arch: '<tree editable="bottom"><field name="foo" widget="phone"/></tree>', config: { device: { - size_class: config.device.SIZES.MD, + size_class: config.device.SIZES.LG, }, }, }); @@ -3589,42 +3488,6 @@ QUnit.module('basic_fields', { list.destroy(); }); - QUnit.test('phone field does not allow html injections', function (assert) { - assert.expect(1); - - var form = createView({ - View: FormView, - model: 'partner', - data: this.data, - arch:'<form string="Partners">' + - '<sheet>' + - '<group>' + - '<field name="foo" widget="phone"/>' + - '</group>' + - '</sheet>' + - '</form>', - res_id: 1, - viewOptions: { - mode: 'edit', - }, - config: { - device: { - size_class: config.device.SIZES.VSM, - }, - }, - }); - - var val = '<script>throw Error();</script><script>throw Error();</script>'; - form.$('input').val(val).trigger('input'); - - // save - form.$buttons.find('.o_form_button_save').click(); - assert.strictEqual(form.$('.o_field_widget').text(), val, - "value should have been correctly escaped"); - - form.destroy(); - }); - QUnit.test('use TAB to navigate to a phone field', function (assert) { assert.expect(2); |
