|
1 | | -import attribute from '../../dist/selectors/attribute.js'; |
2 | | -import {test} from './util/helpers.mjs'; |
| 1 | +import attribute from "../../dist/selectors/attribute.js"; |
| 2 | +import { test } from "./util/helpers.mjs"; |
3 | 3 | const Attribute = attribute.default; |
4 | 4 |
|
5 | 5 | function waitForWarning() { |
6 | | - return new Promise((resolve) => { |
7 | | - process.once('warning', (err) => { |
8 | | - resolve(err); |
9 | | - }); |
| 6 | + return new Promise((resolve) => { |
| 7 | + process.once("warning", (err) => { |
| 8 | + resolve(err); |
10 | 9 | }); |
| 10 | + }); |
11 | 11 | } |
12 | 12 |
|
13 | | -test.serial('deprecated constructor', '', (t) => { |
14 | | - const warningWaiter = waitForWarning(); |
| 13 | +test.serial("deprecated constructor", "", (t) => { |
| 14 | + const warningWaiter = waitForWarning(); |
15 | 15 |
|
16 | | - new Attribute({ value: '"foo"', attribute: "data-bar" }); |
| 16 | + new Attribute({ value: '"foo"', attribute: "data-bar" }); |
17 | 17 |
|
18 | | - return warningWaiter.then((warning) => { |
19 | | - t.deepEqual(warning.message, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now."); |
20 | | - }); |
| 18 | + return warningWaiter.then((warning) => { |
| 19 | + t.deepEqual( |
| 20 | + warning.message, |
| 21 | + "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.", |
| 22 | + ); |
| 23 | + }); |
21 | 24 | }); |
22 | 25 |
|
23 | | -test.serial('deprecated get of raws.unquoted ', '', (t) => { |
24 | | - const warningWaiter = waitForWarning(); |
| 26 | +test.serial("deprecated get of raws.unquoted ", "", (t) => { |
| 27 | + const warningWaiter = waitForWarning(); |
25 | 28 |
|
26 | | - let attr = new Attribute({ value: 'foo', quoteMark: '"', attribute: "data-bar" }); |
27 | | - // eslint-disable-next-line no-unused-expressions -- accessing the getter triggers the deprecation warning under test |
28 | | - attr.raws.unquoted; |
| 29 | + let attr = new Attribute({ value: "foo", quoteMark: '"', attribute: "data-bar" }); |
| 30 | + // eslint-disable-next-line no-unused-expressions -- accessing the getter triggers the deprecation warning under test |
| 31 | + attr.raws.unquoted; |
29 | 32 |
|
30 | | - return warningWaiter.then((warning) => { |
31 | | - t.deepEqual(warning.message, "attr.raws.unquoted is deprecated. Call attr.value instead."); |
32 | | - }); |
| 33 | + return warningWaiter.then((warning) => { |
| 34 | + t.deepEqual(warning.message, "attr.raws.unquoted is deprecated. Call attr.value instead."); |
| 35 | + }); |
33 | 36 | }); |
34 | 37 |
|
35 | | -test.serial('deprecated set of raws.unquoted ', '', (t) => { |
36 | | - const warningWaiter = waitForWarning(); |
| 38 | +test.serial("deprecated set of raws.unquoted ", "", (t) => { |
| 39 | + const warningWaiter = waitForWarning(); |
37 | 40 |
|
38 | | - let attr = new Attribute({ value: 'foo', quoteMark: '"', attribute: "data-bar" }); |
39 | | - attr.raws.unquoted = 'fooooo'; |
| 41 | + let attr = new Attribute({ value: "foo", quoteMark: '"', attribute: "data-bar" }); |
| 42 | + attr.raws.unquoted = "fooooo"; |
40 | 43 |
|
41 | | - return warningWaiter.then((warning) => { |
42 | | - t.deepEqual(warning.message, "Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now."); |
43 | | - }); |
| 44 | + return warningWaiter.then((warning) => { |
| 45 | + t.deepEqual( |
| 46 | + warning.message, |
| 47 | + "Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now.", |
| 48 | + ); |
| 49 | + }); |
44 | 50 | }); |
0 commit comments