summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/relational_fields_tests.js
diff options
context:
space:
mode:
authorAlexandre Kühn <alexkuhn@users.noreply.github.com>2017-11-20 10:47:43 +0100
committerGitHub <noreply@github.com>2017-11-20 10:47:43 +0100
commit23e6dd36d7477f13fe42fdcaae890ffb690d05a4 (patch)
treee797dc6b2a29d4d106c86dd937761c405399e4f4 /addons/web/static/tests/fields/relational_fields_tests.js
parent7d2666d020215d8d8fe36c32f4a8e049e5d7915c (diff)
[IMP] web: hide in kanban tag's color (#20815)
New feature: - New Transparent tag visual (grey border & text, white bg), - By default, newly created kanban tags are transparent, - Tag's colorpicker has now a 'Hide in Kanban' checkbox, to select the transparent color. Toggling off 'Hide in Kanban' sets the color of the tag as follow: - Previous color, if 'Hide in Kanban' was toggled on on the same formview session. - Color 1 (dark orange), otherwise.
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/relational_fields_tests.js27
1 files changed, 26 insertions, 1 deletions
diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js
index aa8fa8e4d0c..cc5f3d31ef5 100644
--- a/addons/web/static/tests/fields/relational_fields_tests.js
+++ b/addons/web/static/tests/fields/relational_fields_tests.js
@@ -8322,7 +8322,7 @@ QUnit.module('relational_fields', {
});
QUnit.test('fieldmany2many tags with color: rendering and edition', function (assert) {
- assert.expect(20);
+ assert.expect(28);
this.data.partner.records[0].timmy = [12, 14];
this.data.partner_type.records.push({id: 13, display_name: "red", color: 8});
@@ -8391,6 +8391,31 @@ QUnit.module('relational_fields', {
// save the record (should do the write RPC with the correct commands)
form.$buttons.find('.o_form_button_save').click();
+ // checkbox 'Hide in Kanban'
+ $input = form.$('.o_field_many2manytags span[data-id=13]'); // selects 'red' tag
+ $input.click(); // opens the colorpicker dropdown
+ assert.ok(form.$('.o_field_many2manytags span[data-id=13] .o_colorpicker .o_checkbox'), "should have a checkbox in the colorpicker dropdown menu");
+
+ $input.click();
+ var $checkBox = form.$('.o_field_many2manytags span[data-id=13] .o_colorpicker .o_checkbox input');
+ assert.notOk($checkBox.is(':checked'), "should have unticked checkbox in colorpicker dropdown menu");
+
+ $checkBox.mousedown();
+ $input = form.$('.o_field_many2manytags span[data-id=13]'); // refresh
+ assert.equal($input.data('color'), "0", "should become transparent when toggling on checkbox");
+
+ $input.click();
+ $checkBox = form.$('.o_field_many2manytags span[data-id=13] .o_colorpicker .o_checkbox input'); // refresh
+ assert.ok($checkBox.is(':checked'), "should have a ticked checkbox in colorpicker dropdown menu after mousedown");
+
+ $checkBox.mousedown();
+ $input = form.$('.o_field_many2manytags span[data-id=13]'); // refresh
+ assert.equal($input.data('color'), "8", "should revert to old color when toggling off checkbox");
+
+ $input.click();
+ $checkBox = form.$('.o_field_many2manytags span[data-id=13] .o_colorpicker .o_checkbox input'); // refresh
+ assert.notOk($checkBox.is(':checked'), "should have an unticked checkbox in colorpicker dropdown menu after 2nd click");
+
// TODO: it would be nice to test the behaviors of the autocomplete dropdown
// (like refining the research, creating new tags...), but ui-autocomplete
// makes it difficult to test