diff options
| author | qsm-odoo <qsm@odoo.com> | 2018-03-14 16:21:14 +0100 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2018-07-27 12:36:54 +0200 |
| commit | 1c1c0897e8eca607c7f1b96b68a06c026c543e6a (patch) | |
| tree | 1f667224be28146cbcbe602892094046052ea93b /addons/web/static/tests/fields/basic_fields_tests.js | |
| parent | 220e49f9d66f2e2ea875143c2da0c20919ec0b3e (diff) | |
[REF] *: BS4, adapt dropdowns and carets
- The dropdown structure was simplified, allowing to get rid of the
3-levels structure induced by <ul/> elements and dropdowns can now
contain anything. The class 'dropdown-item' is now mandatory for
each dropdown clickable element. The class 'dropdown-item-text' can
be used to add same padding and style but without making the element
have a clickable look.
- Dividers now use the class 'dropdown-divider'
- The way dropdowns are opened and hidden also changed (before the
'open' class was added on the `.dropdown-menu` parent, now the
'show' class is added on both the `.dropdown-menu` parent and the
`.dropdown-menu` itself).
- JS-wise, no click event handlers can be put on `.dropdown-toggle`
elements anymore (instead, use handlers for dropdown events).
- Carets are automatically put on `.dropdown-toggle` elements, so this
commit replaces the `.caret` elements with this. This feature was
possible to disable but would prevent us from adding a caret with
scss. Also, this simplifies the DOM. The 'o-no-caret' class was also
introduced to allow using the 'dropdown-toggle' class on non-caret
elements.
- Also adapt the scss to use $caret-width instead of $caret-width-base
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
| -rw-r--r-- | addons/web/static/tests/fields/basic_fields_tests.js | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index ffb0f6198d5..a2224193bab 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -3698,19 +3698,19 @@ QUnit.module('basic_fields', { "should have one red status since selection is the second, blocked state"); assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_green').length, 0, "should not have one green status since selection is the second, blocked state"); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(form.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown"); // Click on the status button to make the dropdown appear form.$('.o_field_widget.o_selection .o_status').first().click(); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 1, + assert.strictEqual(form.$('.dropdown-menu.state:visible').length, 1, "there should be a dropdown"); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible li').length, 2, + assert.strictEqual(form.$('.dropdown-menu.state:visible .dropdown-item').length, 2, "there should be two options in the dropdown"); // Click on the first option, "Normal" - form.$('ul.dropdown-menu.state:visible li').first().click(); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0, + form.$('.dropdown-menu.state:visible .dropdown-item').first().click(); + assert.strictEqual(form.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown anymore"); assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 0, "should not have one red status since selection is the first, normal state"); @@ -3721,7 +3721,7 @@ QUnit.module('basic_fields', { // switch to edit mode and check the result form.$buttons.find('.o_form_button_edit').click(); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(form.$('.dropdown-menu.state:visible').length, 0, "there should still not be a dropdown"); assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 0, "should still not have one red status since selection is the first, normal state"); @@ -3732,14 +3732,14 @@ QUnit.module('basic_fields', { // Click on the status button to make the dropdown appear form.$('.o_field_widget.o_selection .o_status').first().click(); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 1, + assert.strictEqual(form.$('.dropdown-menu.state:visible').length, 1, "there should be a dropdown"); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible li').length, 2, + assert.strictEqual(form.$('.dropdown-menu.state:visible .dropdown-item').length, 2, "there should be two options in the dropdown"); // Click on the last option, "Done" - form.$('ul.dropdown-menu.state:visible li').last().click(); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0, + form.$('.dropdown-menu.state:visible .dropdown-item').last().click(); + assert.strictEqual(form.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown anymore"); assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 0, "should not have one red status since selection is the third, done state"); @@ -3748,7 +3748,7 @@ QUnit.module('basic_fields', { // save form.$buttons.find('.o_form_button_save').click(); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(form.$('.dropdown-menu.state:visible').length, 0, "there should still not be a dropdown anymore"); assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 0, "should still not have one red status since selection is the third, done state"); @@ -3777,7 +3777,7 @@ QUnit.module('basic_fields', { "should have one red status"); assert.strictEqual(list.$('.o_state_selection_cell .o_selection > a span.o_status.o_status_green').length, 1, "should have one green status"); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown"); // Click on the status button to make the dropdown appear @@ -3785,20 +3785,20 @@ QUnit.module('basic_fields', { list.$('.o_state_selection_cell .o_selection > a span.o_status').first().click(); assert.ok(!$cell.parent().hasClass('o_selected_row'), 'should not be in edit mode since we clicked on the state selection widget'); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 1, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 1, "there should be a dropdown"); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible li').length, 2, + assert.strictEqual(list.$('.dropdown-menu.state:visible .dropdown-item').length, 2, "there should be two options in the dropdown"); // Click on the first option, "Normal" - list.$('ul.dropdown-menu.state:visible li').first().click(); + list.$('.dropdown-menu.state:visible .dropdown-item').first().click(); assert.strictEqual(list.$('.o_state_selection_cell .o_selection > a span.o_status').length, 5, "should still have five status selection widgets"); assert.strictEqual(list.$('.o_state_selection_cell .o_selection > a span.o_status.o_status_red').length, 0, "should now have no red status"); assert.strictEqual(list.$('.o_state_selection_cell .o_selection > a span.o_status.o_status_green').length, 1, "should still have one green status"); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown"); // switch to edit mode and check the result @@ -3812,21 +3812,21 @@ QUnit.module('basic_fields', { "should now have no red status"); assert.strictEqual(list.$('.o_state_selection_cell .o_selection > a span.o_status.o_status_green').length, 1, "should still have one green status"); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown"); // Click on the status button to make the dropdown appear list.$('.o_state_selection_cell .o_selection > a span.o_status').first().click(); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 1, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 1, "there should be a dropdown"); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible li').length, 2, + assert.strictEqual(list.$('.dropdown-menu.state:visible .dropdown-item').length, 2, "there should be two options in the dropdown"); // Click on another row var $firstCell = list.$('tbody td.o_state_selection_cell').first(); var $lastCell = list.$('tbody td.o_state_selection_cell').last(); $lastCell.click(); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown anymore"); assert.ok(!$firstCell.parent().hasClass('o_selected_row'), 'first row should not be in edit mode anymore'); @@ -3835,14 +3835,14 @@ QUnit.module('basic_fields', { // Click on the last status button to make the dropdown appear list.$('.o_state_selection_cell .o_selection > a span.o_status').last().click(); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 1, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 1, "there should be a dropdown"); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible li').length, 2, + assert.strictEqual(list.$('.dropdown-menu.state:visible .dropdown-item').length, 2, "there should be two options in the dropdown"); // Click on the last option, "Done" - list.$('ul.dropdown-menu.state:visible li').last().click(); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 0, + list.$('.dropdown-menu.state:visible .dropdown-item').last().click(); + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown anymore"); assert.strictEqual(list.$('.o_state_selection_cell .o_selection > a span.o_status').length, 5, "should still have five status selection widgets"); @@ -3850,7 +3850,7 @@ QUnit.module('basic_fields', { "should still have no red status"); assert.strictEqual(list.$('.o_state_selection_cell .o_selection > a span.o_status.o_status_green').length, 2, "should now have two green status"); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown"); // save @@ -3861,7 +3861,7 @@ QUnit.module('basic_fields', { "should have no red status"); assert.strictEqual(list.$('.o_state_selection_cell .o_selection > a span.o_status.o_status_green').length, 2, "should have two green status"); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown"); list.destroy(); |
