Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolai-shabalin committed Jan 12, 2024
1 parent b54ed49 commit 43ca199
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
14 changes: 14 additions & 0 deletions rules/attr-req-value/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,17 @@
<img src="images/image.jpg" width="100" height="100" alt="">
<section data-test></section>
```

## Исключения
Один `<option>` в `<select>` может быть c пустым значением, если он выбран по умолчанию.

Следующий шаблон **не** считается проблемой:

```html
<label for="fruits">Fruits</label>
<select id="fruits" name="fruits" required>
<option value="">Select...</option>
<option value="banana">Banana</option>
<option value="apple">Apple</option>
</select>
```
19 changes: 19 additions & 0 deletions rules/attr-req-value/fixture/error.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!doctype html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>

<label for="">Fruits</label>

<label for="fruits">Fruits</label>
<select id="fruits" name="fruits" required>
<option value="">Select...</option> <!--problem-->
<option value="">Shmelect...</option> <!--problem-->
<option value="banana">Banana</option>
<option value="apple">Apple</option>
</select>
</body>
</html>
28 changes: 28 additions & 0 deletions rules/attr-req-value/fixture/success.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!doctype html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>

<label for="fruits-3">Fruits</label>
<select id="fruits-3" name="fruits" required>
<option value="orange">Orange</option>
</select>

<label for="fruits-2">Fruits</label>
<select id="fruits-2" name="fruits" required>
<option value="orange">Orange</option>
<option value="banana">Banana</option>
<option value="apple">Apple</option>
</select>

<label for="fruits">Fruits</label>
<select id="fruits" name="fruits" required>
<option value="">Select...</option>
<option value="banana">Banana</option>
<option value="apple">Apple</option>
</select>
</body>
</html>

0 comments on commit 43ca199

Please sign in to comment.