Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Element-hasAttributes.html

Issue 1923043002: Import web-platform-tests@028d354aba4c8ee6700def957a45f3927241d8b0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix expectations after the test harness was updated Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!doctype html>
2 <meta charset="utf-8">
3 <title></title>
4 <script src="../../../../resources/testharness.js"></script>
5 <script src="../../../../resources/testharnessreport.js"></script>
6 <body>
7
8 <button></button>
9 <div id="foo"></div>
10 <p data-foo=""></p>
11
12 <script>
13 test(function() {
14 var buttonElement = document.getElementsByTagName('button')[0];
15 assert_equals(buttonElement.hasAttributes(), false, 'hasAttributes() on empt y element must return false.');
16
17 var emptyDiv = document.createElement('div');
18 assert_equals(emptyDiv.hasAttributes(), false, 'hasAttributes() on dynamical ly created empty element must return false.');
19
20 }, 'element.hasAttributes() must return false when the element does not have att ribute.');
21
22 test(function() {
23 var divWithId = document.getElementById('foo');
24 assert_equals(divWithId.hasAttributes(), true, 'hasAttributes() on element w ith id attribute must return true.');
25
26 var divWithClass = document.createElement('div');
27 divWithClass.setAttribute('class', 'foo');
28 assert_equals(divWithClass.hasAttributes(), true, 'hasAttributes() on dynami cally created element with class attribute must return true.');
29
30 var pWithCustomAttr = document.getElementsByTagName('p')[0];
31 assert_equals(pWithCustomAttr.hasAttributes(), true, 'hasAttributes() on ele ment with custom attribute must return true.');
32
33 var divWithCustomAttr = document.createElement('div');
34 divWithCustomAttr.setAttribute('data-custom', 'foo');
35 assert_equals(divWithCustomAttr.hasAttributes(), true, 'hasAttributes() on d ynamically created element with custom attribute must return true.');
36
37 }, 'element.hasAttributes() must return true when the element has attribute.');
38
39 </script>
40 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698