Skip to content

Commit 2af9ef8

Browse files
committed
[fix] - Resolve tests.
1 parent 4cdc8fd commit 2af9ef8

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

src/rules/label-uses-for.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = context => ({
2727

2828
const htmlForAttr = hasAttribute(node.attributes, 'htmlFor');
2929
const htmlForValue = getAttributeValue(htmlForAttr);
30-
const isInvalid = htmlForAttr === false || htmlForValue === null || htmlForValue === undefined;
30+
const isInvalid = htmlForAttr === false || !htmlForValue;
3131

3232
if (isInvalid) {
3333
context.report({

tests/src/rules/img-uses-alt.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ ruleTester.run('img-uses-alt', rule, {
6363
{ code: '<img alt={bar() || ""} />', parserOptions },
6464
{ code: '<img alt={foo.bar() || ""} />', parserOptions },
6565
{ code: '<img alt="" />', parserOptions },
66+
{ code: '<img alt={`${undefined}`} />', parserOptions },
6667
{ code: '<img alt=" " />', parserOptions },
6768
{ code: '<img alt="" role="presentation" />', parserOptions },
6869
{ code: '<img alt="" role={`presentation`} />', parserOptions },
@@ -124,7 +125,6 @@ ruleTester.run('img-uses-alt', rule, {
124125
{ code: '<img />;', errors: [ missingPropError('img') ], parserOptions },
125126
{ code: '<img alt />;', errors: [ altValueError('img') ], parserOptions },
126127
{ code: '<img alt={undefined} />;', errors: [ altValueError('img') ], parserOptions },
127-
{ code: '<img alt={`${undefined}`} />;', errors: [ altValueError('img') ], parserOptions },
128128
{ code: '<img src="xyz" />', errors: [ missingPropError('img') ], parserOptions },
129129
{ code: '<img {...this.props} />', errors: [ missingPropError('img') ], parserOptions },
130130
{ code: '<img alt={false || false} />', errors: [ altValueError('img') ], parserOptions },
@@ -138,12 +138,6 @@ ruleTester.run('img-uses-alt', rule, {
138138
},
139139
{ code: '<Avatar alt />;', errors: [ altValueError('Avatar') ], options: string, parserOptions },
140140
{ code: '<Avatar alt={undefined} />;', errors: [ altValueError('Avatar') ], options: string, parserOptions },
141-
{
142-
code: '<Avatar alt={`${undefined}`} />;',
143-
errors: [ altValueError('Avatar') ],
144-
options: string,
145-
parserOptions
146-
},
147141
{ code: '<Avatar src="xyz" />', errors: [ missingPropError('Avatar') ], options: string, parserOptions },
148142
{ code: '<Avatar {...this.props} />', errors: [ missingPropError('Avatar') ], options: string, parserOptions },
149143

@@ -156,12 +150,6 @@ ruleTester.run('img-uses-alt', rule, {
156150
options: array,
157151
parserOptions
158152
},
159-
{
160-
code: '<Thumbnail alt={`${undefined}`} />;',
161-
errors: [ altValueError('Thumbnail') ],
162-
options: array,
163-
parserOptions
164-
},
165153
{ code: '<Thumbnail src="xyz" />', errors: [ missingPropError('Thumbnail') ], options: array, parserOptions },
166154
{
167155
code: '<Thumbnail {...this.props} />',
@@ -172,7 +160,6 @@ ruleTester.run('img-uses-alt', rule, {
172160
{ code: '<Image />;', errors: [ missingPropError('Image') ], options: array, parserOptions },
173161
{ code: '<Image alt />;', errors: [ altValueError('Image') ], options: array, parserOptions },
174162
{ code: '<Image alt={undefined} />;', errors: [ altValueError('Image') ], options: array, parserOptions },
175-
{ code: '<Image alt={`${undefined}`} />;', errors: [ altValueError('Image') ], options: array, parserOptions },
176163
{ code: '<Image src="xyz" />', errors: [ missingPropError('Image') ], options: array, parserOptions },
177164
{ code: '<Image {...this.props} />', errors: [ missingPropError('Image') ], options: array, parserOptions }
178165
]

0 commit comments

Comments
 (0)