[FIX] web: tests: fix typos in :{last,first}-child

Follow-up of odoo/enterprise#11881, in order to eliminate all similar
typos.

The CSS pseudo-class selectors are spelled `:first-child` and
`:last-child`, and never take any argument, as opposed to
`:nth-child(<nth>)` for example.

Ref: https://developer.mozilla.org/docs/Web/CSS/Pseudo-classes

jQuery doesn't care and matches with or without the `()`, but CSS
engines don't, and now libsass SCSS compilation crashes due to the empty
argument list (cfr. opw-2299465)

Better avoid confusion and fix the typo everywhere.

closes odoo/odoo#54685

X-original-commit: 82244e17339615615535073e6f9e1ddbcf0b57d9
Signed-off-by: Richard Mathot (rim) <rim@openerp.com>
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
This commit is contained in:
Olivier Dony
2020-07-17 14:36:08 +00:00
parent c580197a20
commit 2e17c0458c
@@ -4323,13 +4323,13 @@ QUnit.module('basic_fields', {
await testUtils.form.clickCreate(form);
testUtils.dom.openDatepicker(form.$('.o_datepicker'));
$.each($('.day:last-child(),.day:nth-child(2)'), function (index, value) {
$.each($('.day:last-child,.day:nth-child(2)'), function (index, value) {
assert.hasClass(value, 'disabled', 'first and last days must be disabled');
});
// the assertions below could be replaced by a single hasClass classic on the jQuery set using the idea
// All not <=> not Exists. But we want to be sure that the set is non empty. We don't have an helper
// function for that.
$.each($('.day:not(:last-child()):not(:nth-child(2))'), function (index, value) {
$.each($('.day:not(:last-child):not(:nth-child(2))'), function (index, value) {
assert.doesNotHaveClass(value, 'disabled', 'other days must stay clickable');
});
form.destroy();