Skip to content

Commit 1508ed8

Browse files
authored
2.1.0 (#22)
* readme: remove old TravisCI build status * changelog for 2.1.0
1 parent 662e773 commit 1508ed8

File tree

2 files changed

+52
-66
lines changed

2 files changed

+52
-66
lines changed

changelog.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Changelog
22

3-
- `2.0.0` - new `onSubmit` rule (thank you @@jzatt), upgrade to ESLint 8 and Mocha 9, fix moderate security advisory for `chalk/ansi-regex`
4-
- `1.3.0` - Add auto-fix capability to `onClick` (thank you @bkonuwa and @pixelbandito). ([#8](https://github.com/davidcalhoun/eslint-plugin-test-selectors/pull/8))
5-
- `1.1.0`
6-
- elements with `disabled` and `readonly` attributes are now ignored by default. See [Custom Rules Options](#custom-rule-options) to customize this behavior. (fixes [#3][i3])
7-
- `plugin:test-selectors/recommended` now emits warnings by default instead of errors. For the old stricter behavior which emits errors, folks can use `plugin:test-selectors/recommendedWithErrors` (fixes [#4][i4])
8-
- Refactoring and cleanup. Readme improvements.
9-
- `1.0.1` - fix bug with inline functions (fixes [#1][i1])
10-
- `1.0.0` - initial release
3+
- `2.1.0` - custom `testAttribute` property now accepts arrays. Also fixes vulnerability in word-wrap.
4+
- `2.0.0` - new `onSubmit` rule (thank you @@jzatt), upgrade to ESLint 8 and Mocha 9, fix moderate security advisory for `chalk/ansi-regex`
5+
- `1.3.0` - Add auto-fix capability to `onClick` (thank you @bkonuwa and @pixelbandito). ([#8](https://github.com/davidcalhoun/eslint-plugin-test-selectors/pull/8))
6+
- `1.1.0`
7+
- elements with `disabled` and `readonly` attributes are now ignored by default. See [Custom Rules Options](#custom-rule-options) to customize this behavior. (fixes [#3][i3])
8+
- `plugin:test-selectors/recommended` now emits warnings by default instead of errors. For the old stricter behavior which emits errors, folks can use `plugin:test-selectors/recommendedWithErrors` (fixes [#4][i4])
9+
- Refactoring and cleanup. Readme improvements.
10+
- `1.0.1` - fix bug with inline functions (fixes [#1][i1])
11+
- `1.0.0` - initial release

readme.md

Lines changed: 43 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
# eslint-plugin-test-selectors
22

3-
[![Build Status](https://travis-ci.org/davidcalhoun/eslint-plugin-test-selectors.svg?branch=master)](https://travis-ci.org/davidcalhoun/eslint-plugin-test-selectors)
43
[![Downloads][downloads-image]][npm-url]
54

65
Enforces that a `data-test-id` attribute is present on interactive DOM elements to help with UI testing.
76

8-
-`<button>Download</button>`
9-
-`<button data-test-id="download-button">Download</button>`
7+
- `<button>Download</button>`
8+
- `<button data-test-id="download-button">Download</button>`
109

1110
### Example of eslint-plugin-test-selectors running in Visual Studio Code:
1211

1312
![Example of eslint-plugin-test-selectors running in Visual Studio Code](https://github.com/davidcalhoun/eslint-plugin-test-selectors/blob/master/vscode-test-selectors-example.png)
1413

15-
## Changelog
14+
## Selected changelog
1615

17-
- `2.0.0` - new `onSubmit` rule (thank you @@jzatt), upgrade to ESLint 8 and Mocha 9, fix moderate security advisory for `chalk/ansi-regex`
18-
- `1.3.0` - Add auto-fix capability to `onClick` (thank you @bkonuwa and @pixelbandito). ([#8](https://github.com/davidcalhoun/eslint-plugin-test-selectors/pull/8))
19-
- `1.1.0`
20-
- elements with `disabled` and `readonly` attributes are now ignored by default. See [Custom Rules Options](#custom-rule-options) to customize this behavior. (fixes [#3][i3])
21-
- `plugin:test-selectors/recommended` now emits warnings by default instead of errors. For the old stricter behavior which emits errors, folks can use `plugin:test-selectors/recommendedWithErrors` (fixes [#4][i4])
22-
- Refactoring and cleanup. Readme improvements.
23-
- `1.0.1` - fix bug with inline functions (fixes [#1][i1])
24-
- `1.0.0` - initial release
16+
[See full changelog](https://github.com/davidcalhoun/eslint-plugin-test-selectors/blob/main/changelog.md)
17+
18+
- `2.1.0` - custom `testAttribute` property now accepts arrays. Also fixes vulnerability in word-wrap.
19+
- `2.0.0` - new `onSubmit` rule (thank you @@jzatt), upgrade to ESLint 8 and Mocha 9, fix moderate security advisory for `chalk/ansi-regex`
20+
- `1.3.0` - Add auto-fix capability to `onClick` (thank you @bkonuwa and @pixelbandito). ([#8](https://github.com/davidcalhoun/eslint-plugin-test-selectors/pull/8))
2521

2622
## Installation
2723

@@ -45,15 +41,15 @@ Add `test-selectors` to the plugins section of your `.eslintrc` configuration fi
4541

4642
```json
4743
{
48-
"plugins": ["test-selectors"]
44+
"plugins": ["test-selectors"]
4945
}
5046
```
5147

5248
If you want to use all the recommended default rules, you can simply add this line to the `extends` section of your `.eslintrc` configuration:
5349

5450
```json
5551
{
56-
"extends": ["plugin:test-selectors/recommended"]
52+
"extends": ["plugin:test-selectors/recommended"]
5753
}
5854
```
5955

@@ -63,19 +59,19 @@ Another option: you can also selectively enable and disable individual rules in
6359

6460
```json
6561
{
66-
"rules": {
67-
"test-selectors/button": ["warn", "always"]
68-
}
62+
"rules": {
63+
"test-selectors/button": ["warn", "always"]
64+
}
6965
}
7066
```
7167

7268
If you like most of the recommended rules by adding the `extends` option above, but find one in particular to be bothersome, you can simply disable it:
7369

7470
```json
7571
{
76-
"rules": {
77-
"test-selectors/anchor": "off"
78-
}
72+
"rules": {
73+
"test-selectors/anchor": "off"
74+
}
7975
}
8076
```
8177

@@ -91,40 +87,31 @@ The default test attribute expected is `data-test-id`, but you can override it w
9187

9288
```json
9389
{
94-
"rules": {
95-
"test-selectors/onChange": [
96-
"warn",
97-
"always",
98-
{ "testAttribute": "data-some-custom-attribute" }
99-
]
100-
}
90+
"rules": {
91+
"test-selectors/onChange": ["warn", "always", { "testAttribute": "data-some-custom-attribute" }]
92+
}
10193
}
10294
```
10395

104-
Note: You can also pass multiple attributes
96+
Note: You can also pass multiple attributes
10597

10698
```json
10799
{
108-
"rules": {
109-
"test-selectors/onChange": [
110-
"warn",
111-
"always",
112-
{ "testAttribute": ["data-testid", "testId"] }
113-
]
114-
}
100+
"rules": {
101+
"test-selectors/onChange": ["warn", "always", { "testAttribute": ["data-testid", "testId"] }]
102+
}
115103
}
116104
```
117105

118-
119106
### ignoreDisabled
120107

121108
By default all elements with the `disabled` attribute are ignored, e.g. `<input disabled />`. If you don't want to ignore this attribute, set `ignoreDisabled` to `false`:
122109

123110
```json
124111
{
125-
"rules": {
126-
"test-selectors/onChange": ["warn", "always", { "ignoreDisabled": false }]
127-
}
112+
"rules": {
113+
"test-selectors/onChange": ["warn", "always", { "ignoreDisabled": false }]
114+
}
128115
}
129116
```
130117

@@ -134,9 +121,9 @@ By default all elements with the `readonly` attribute are ignored, e.g. `<input
134121

135122
```json
136123
{
137-
"rules": {
138-
"test-selectors/onChange": ["warn", "always", { "ignoreReadonly": false }]
139-
}
124+
"rules": {
125+
"test-selectors/onChange": ["warn", "always", { "ignoreReadonly": false }]
126+
}
140127
}
141128
```
142129

@@ -146,34 +133,32 @@ Only supported on `button` rule, this option will exempt React components called
146133

147134
```json
148135
{
149-
"rules": {
150-
"test-selectors/button": ["warn", "always", { "htmlOnly": true }]
151-
}
136+
"rules": {
137+
"test-selectors/button": ["warn", "always", { "htmlOnly": true }]
138+
}
152139
}
153140
```
154141

155142
## Supported Rules
156143

157-
- `test-selectors/anchor`
158-
- `test-selectors/button`
159-
- `test-selectors/input`
160-
- `test-selectors/onChange`
161-
- `test-selectors/onClick`
162-
- `test-selectors/onKeyDown`
163-
- `test-selectors/onKeyUp`
164-
- `test-selectors/onSubmit`
165-
166-
144+
- `test-selectors/anchor`
145+
- `test-selectors/button`
146+
- `test-selectors/input`
147+
- `test-selectors/onChange`
148+
- `test-selectors/onClick`
149+
- `test-selectors/onKeyDown`
150+
- `test-selectors/onKeyUp`
151+
- `test-selectors/onSubmit`
167152

168153
## Further Reading
169154

170155
If you don't want these test attributes added in production, you can use something like [babel-plugin-jsx-remove-data-test-id](https://github.com/coderas/babel-plugin-jsx-remove-data-test-id)
171156

172157
Why `data` attributes and not `id` or `class`? Check out some of the following:
173158

174-
- [Decoupling CSS Selectors From Your Tests](https://mixandgo.com/learn/decoupling-css-selectors-from-your-tests)
175-
- [Test your DOM with Data Attributes](https://medium.com/@colecodes/test-your-dom-with-data-attributes-44fccc43ed4b)
176-
- [Something Better than IDs for Identifying Elements in Selenium Tests](https://techblog.constantcontact.com/software-development/a-better-way-to-id-elements-in-selenium-tests/)
159+
- [Decoupling CSS Selectors From Your Tests](https://mixandgo.com/learn/decoupling-css-selectors-from-your-tests)
160+
- [Test your DOM with Data Attributes](https://medium.com/@colecodes/test-your-dom-with-data-attributes-44fccc43ed4b)
161+
- [Something Better than IDs for Identifying Elements in Selenium Tests](https://techblog.constantcontact.com/software-development/a-better-way-to-id-elements-in-selenium-tests/)
177162

178163
[downloads-image]: https://img.shields.io/npm/dm/eslint-plugin-test-selectors.svg?style=flat-square
179164
[npm-url]: https://www.npmjs.com/package/eslint-plugin-test-selectors

0 commit comments

Comments
 (0)