Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove test-level assert property from tests #14409

Merged
merged 3 commits into from
Dec 10, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion common/performance-timeline-utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
author: W3C http://www.w3.org/
help: http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute
*/
var performanceNamespace = window.performance;
var namespace_check = false;
function wp_test(func, msg, properties)
Expand All @@ -10,7 +14,8 @@ function wp_test(func, msg, properties)
if (performanceNamespace === undefined || performanceNamespace == null)
{
// show a single error that window.performance is undefined
test(function() { assert_true(performanceNamespace !== undefined && performanceNamespace != null, "window.performance is defined and not null"); }, "window.performance is defined and not null.", {author:"W3C http://www.w3.org/",help:"http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",assert:"The window.performance attribute provides a hosting area for performance related attributes. "});
// The window.performance attribute provides a hosting area for performance related attributes.
test(function() { assert_true(performanceNamespace !== undefined && performanceNamespace != null, "window.performance is defined and not null"); }, "window.performance is defined and not null.");
}
}

Expand Down
4 changes: 2 additions & 2 deletions css/css-transitions/currentcolor-animation-001.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<div id="test"></div>
<script>

// Transition does not occur when the value is currentColor and color changes
test(function() {
var div = document.getElementById("test");
var cs = getComputedStyle(div, "");
Expand All @@ -32,8 +33,7 @@
assert_true(quarter_interpolated != quarter_reference &&
quarter_interpolated == final_reference);
},
"currentcolortransition",
{ assert: "Transition does not occur when the value is currentColor and color changes" });
"currentcolortransition");

</script>
</body>
Expand Down
6 changes: 2 additions & 4 deletions css/css-transitions/transitions-animatable-properties-01.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,8 @@

// create all the tests we need
for (var i = 0; i < kANIMATABLE_CSS_PROPERTIES.length; i++) {
testsIntermediate.push(async_test(kANIMATABLE_CSS_PROPERTIES[i][0] + " intermediate",
{ assert: "property " + kANIMATABLE_CSS_PROPERTIES[i][0] + " is animatable" }));
testsEnd.push(async_test(kANIMATABLE_CSS_PROPERTIES[i][0] + " end",
{ assert: "property " + kANIMATABLE_CSS_PROPERTIES[i][0] + " has correct value after transition's end" }));
testsIntermediate.push(async_test(kANIMATABLE_CSS_PROPERTIES[i][0] + " intermediate"));
testsEnd.push(async_test(kANIMATABLE_CSS_PROPERTIES[i][0] + " end"));
}

// getComputedStyle helper
Expand Down
18 changes: 8 additions & 10 deletions css/css-values/calc-unit-analysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
test_elt.style.setProperty(property, value);
test_elt.style.removeProperty(property);
},
description_to_name(description),
{ assert: "invalid calc expression: " + description });
description_to_name(description));
}

function assert_valid_value(property, value, computes_to, description) {
Expand All @@ -46,27 +45,26 @@
computes_to);
test_elt.style.removeProperty(property);
},
description_to_name(description),
{ assert: "valid calc expression: " + description });
description_to_name(description));
}

assert_invalid_value("margin-left", "calc(0)",
assert_invalid_value("margin-left", "calc(0)", // invalid calc expression
"unitless zero in calc() is a numeric type, not length");
assert_valid_value("margin-left", "calc(0px)", "0px",
"0px in calc()");
assert_invalid_value("margin-left", "calc(1px + 2)",
assert_invalid_value("margin-left", "calc(1px + 2)", // invalid calc expression
"addition of length and number");
assert_invalid_value("margin-left", "calc(2 + 1px)",
assert_invalid_value("margin-left", "calc(2 + 1px)", // invalid calc expression
"addition of number and length");
assert_invalid_value("margin-left", "calc(1px - 2)",
assert_invalid_value("margin-left", "calc(1px - 2)", // invalid calc expression
"subtraction of length and number");
assert_invalid_value("margin-left", "calc(2 - 1px)",
assert_invalid_value("margin-left", "calc(2 - 1px)", // invalid calc expression
"subtraction of number and length");
assert_valid_value("margin-left", "calc(2px * 2)", "4px",
"multiplication of length and number");
assert_valid_value("margin-left", "calc(2 * 2px)", "4px",
"multiplication of number and length");
assert_invalid_value("margin-left", "calc(2px * 1px)",
assert_invalid_value("margin-left", "calc(2px * 1px)", // invalid calc expression
"multiplication of length and length");

}
Expand Down
6 changes: 2 additions & 4 deletions css/css-variables/test_variable_legal_values.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
assert_not_equals(initial_cs, red_cs);
assert_equals(initial_cs, test_cs.backgroundColor);
},
description_to_name(description),
{ assert: "Value allowed within variable: " + description });
description_to_name(description));
}

function assert_disallowed_balanced_variable_value(value, description) {
Expand All @@ -59,8 +58,7 @@
assert_not_equals(green_cs, red_cs);
assert_equals(green_cs, test_cs.backgroundColor);
},
description_to_name(description),
{ assert: "Value not allowed within variable: " + description });
description_to_name(description));
}

assert_allowed_variable_value("25%", "percentage");
Expand Down
10 changes: 4 additions & 6 deletions css/cssom-view/offsetParent_element_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
var table_element_tr = document.getElementById('table-element-tr');
var table_element = document.getElementById('table-element');

// The offsetParent attribute algorithm rule checking passed!
test(function() {
assert_equals(html.offsetParent,null);
assert_equals(body.offsetParent,null);
Expand All @@ -104,10 +105,9 @@
assert_equals(none_element_child_audio.offsetParent,null);
assert_equals(none_element_child_canvas.offsetParent,null);
assert_equals(none_element_child_svg.offsetParent,undefined);
}, "Valid the algorithm rule of offsetParent check step 1",
{ assert: "The offsetParent attribute algorithm rule checking passed!" }
);
}, "Valid the algorithm rule of offsetParent check step 1");

// The offsetParent attribute algorithm rule checking passed!
test(function() {
assert_equals(body_element_child.offsetParent,body);
assert_equals(window.getComputedStyle(relative_element).position,'relative');
Expand All @@ -122,9 +122,7 @@
assert_equals(caption_element_child.offsetParent,table_element);
assert_equals(window.getComputedStyle(td_element).position,'static');
assert_equals(td_element.offsetParent,table_element);
}, "Valid the algorithm rule of offsetParent check step 2",
{ assert: "The offsetParent attribute algorithm rule checking passed!" }
);
}, "Valid the algorithm rule of offsetParent check step 2");

</script>

Expand Down
20 changes: 8 additions & 12 deletions css/cssom/computed-style-001.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
var inner = document.getElementById("inside");
var innerStyle;

// do not allow modifications to a computed CSSStyleDeclaration
test(function() {
innerStyle = window.getComputedStyle(inner);
assert_throws( "NO_MODIFICATION_ALLOWED_ERR",
Expand All @@ -44,27 +45,22 @@
assert_throws( "NO_MODIFICATION_ALLOWED_ERR",
function() { innerStyle.color = "blue"; },
"do not allow setting a property on a readonly CSSStyleDeclaration");
}, "read_only", {
assert: "do not allow modifications to a computed CSSStyleDeclaration"
});
}, "read_only");

// Directly set properties are resolved
test(function() {
assert_equals(innerStyle.getPropertyValue("height"), "100px");
}, "property_values", {
assert: "Directly set properties are resolved"
});
}, "property_values");

// Inherited properties are resolved
test(function() {
assert_equals(innerStyle.getPropertyValue("font-size"), "100px");
}, "inherited_property_values", {
assert: "Inherited properties are resolved"
});
}, "inherited_property_values");

// Relative properties are resolved
test(function() {
assert_equals(innerStyle.getPropertyValue("width"), "100px");
}, "relative_property_values", {
assert: "Relative properties are resolved"
});
}, "relative_property_values");
</script>
</body>
</html>
10 changes: 4 additions & 6 deletions css/cssom/computed-style-005.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,17 @@
let elem = document.getElementById(id);
let elemStyle = window.getComputedStyle(elem);

// positioned element's auto margins should be resolved to 10px.
test(function() {
assert_equals(elemStyle.getPropertyValue("margin-left"), "10px");
assert_equals(elemStyle.getPropertyValue("margin-right"), "10px");
}, id + "_computed_margins", {
assert: id + "-positioned element's auto margins should be resolved to 10px."
});
}, id + "_computed_margins");

// positioned element should have a left and right of 0px (as authored).
test(function() {
assert_equals(elemStyle.getPropertyValue("left"), "0px");
assert_equals(elemStyle.getPropertyValue("right"), "0px");
}, id + "_computed_left_and_right", {
assert: id + "-positioned element should have a left and right of 0px (as authored)."
});
}, id + "_computed_left_and_right");
}
</script>
</body>
Expand Down
31 changes: 13 additions & 18 deletions css/cssom/inline-style-001.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,22 @@
<div id="log"></div>
<div id="test" style="margin-left: 5px;"></div>
<script type="text/javascript">
// Can access CSSStyleDeclaration through style property
test(function() {
var test = document.getElementById("test");
assert_idl_attribute(test, "style");
declaration = test.style;
}, "CSSStyleDeclaration_accessible", {
assert: "Can access CSSStyleDeclaration through style property"
});
}, "CSSStyleDeclaration_accessible");

// initial property values are correct
test(function() {
assert_equals(declaration.cssText, "margin-left: 5px;");
assert_equals(declaration.getPropertyValue("margin-left"), "5px");
}, "read", {
assert: "initial property values are correct"
});
}, "read");

// setting cssText adds new properties
// setting cssText removes existing properties
// properties set through cssText are reflected in the computed style
test(function() {
declaration.cssText = "margin-left: 10px; padding-left: 10px;";
assert_equals(declaration.cssText, "margin-left: 10px; padding-left: 10px;");
Expand All @@ -41,12 +42,10 @@
var computedStyle = window.getComputedStyle(document.getElementById("test"));
assert_equals(computedStyle.getPropertyValue("margin-left"), "10px");
assert_equals(computedStyle.getPropertyValue("padding-left"), "10px");
}, "csstext_write", {
assert: [ "setting cssText adds new properties",
"setting cssText removes existing properties",
"properties set through cssText are reflected in the computed style"]
});
}, "csstext_write");

// setProperty adds new properties
// properties set through setProperty are reflected in the computed style
test(function() {
while(declaration.length > 0)
declaration.removeProperty(declaration.item(0));
Expand All @@ -62,11 +61,9 @@
var computedStyle = window.getComputedStyle(document.getElementById("test"));
assert_equals(computedStyle.getPropertyValue("margin-left"), "15px");
assert_equals(computedStyle.getPropertyValue("padding-left"), "15px");
}, "property_write", {
assert: [ "setProperty adds new properties",
"properties set through setProperty are reflected in the computed style"]
});
}, "property_write");

// shorthand property is expanded
test(function() {
while(declaration.length > 0)
declaration.removeProperty(declaration.item(0));
Expand All @@ -75,9 +72,7 @@
assert_equals(declaration.getPropertyValue("margin-right"), "20px");
assert_equals(declaration.getPropertyValue("margin-bottom"), "20px");
assert_equals(declaration.getPropertyValue("margin-left"), "20px");
}, "shorthand_properties", {
assert: "shorthand property is expanded"
});
}, "shorthand_properties");
</script>
</body>
</html>
23 changes: 10 additions & 13 deletions css/cssom/medialist-interfaces-001.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<link rel="author" title="Ben Sheldon" href="mailto:[email protected]">
<link rel="author" title="Chapman Shoop" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/TR/cssom-1/#the-medialist-interface">
<link rel="help" href="http://www.w3.org/TR/cssom-1/#serializing-media-queries">
<link rel="help" href="http://www.w3.org/TR/cssom-1/#serialize-a-media-query-list">
<meta name="flags" content="dom">
<meta name="assert" content="MediaLists are serialized according to the specification">
<script src="/resources/testharness.js" type="text/javascript"></script>
Expand Down Expand Up @@ -40,46 +42,41 @@
mediaList = styleSheet.media;
}


// MediaList.mediaText equals the 'media' value of the initial 'style' element.
test(function() {
setup();

assert_equals(mediaList.mediaText, "all");

}, "mediatest_medialist_serialize_element",
{ help: ["http://www.w3.org/TR/cssom-1/#the-medialist-interface", "http://www.w3.org/TR/cssom-1/#serializing-media-queries"],
assert: ["MediaList.mediaText equals the 'media' value of the initial 'style' element."] });
}, "mediatest_medialist_serialize_element");

// To serialize a comma-separated list concatenate all items of the list in list order while separating them by \",\" (U+002C), followed by a space (U+0020).
test(function() {
setup();

mediaList.appendMedium('screen');
assert_equals(mediaList.mediaText, "all, screen");

}, "mediatest_medialist_serialize_comma",
{ help: ["http://www.w3.org/TR/cssom-1/#the-medialist-interface", "http://www.w3.org/TR/cssom-1/#serialize-a-media-query-list"],
assert: ["To serialize a comma-separated list concatenate all items of the list in list order while separating them by \",\" (U+002C), followed by a space (U+0020)."] });
}, "mediatest_medialist_serialize_comma");

// If the media query list is empty return the empty string.
test(function() {
setup();

mediaList.deleteMedium('all');
assert_equals(mediaList.mediaText, "");

}, "mediatest_medialist_serialize_empty",
{ help: ["http://www.w3.org/TR/cssom-1/#the-medialist-interface", "http://www.w3.org/TR/cssom-1/#serializing-media-queries"],
assert: ["If the media query list is empty return the empty string."] });
}, "mediatest_medialist_serialize_empty");

// Each media query should be sorted in the same order as they appear in the list of media queries.
test(function() {
setup();

mediaList.appendMedium('screen');
mediaList.appendMedium('print');
assert_equals(mediaList.mediaText, "all, screen, print");

}, "mediatest_medialist_serialize_order",
{ help: ["http://www.w3.org/TR/cssom-1/#the-medialist-interface", "http://www.w3.org/TR/cssom-1/#serialize-a-media-query-list"],
assert: ["Each media query should be sorted in the same order as they appear in the list of media queries."] });
}, "mediatest_medialist_serialize_order");

</script>
</body>
Expand Down
12 changes: 6 additions & 6 deletions css/cssom/medialist-interfaces-002.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@

<script type="text/javascript">

// MediaList.deleteMedium called without argument throws error.
test(function() {
media_list = setup();
assert_throws(new TypeError, function() { media_list.deleteMedium(); });
}, "deleteMedium_called_without_argument",
{ assert: "MediaList.deleteMedium called without argument throws error." });
}, "deleteMedium_called_without_argument");

// MediaList.deleteMedium removes correct medium and updates corresponding properties.
test(function() {
media_list = setup();

Expand All @@ -50,9 +51,9 @@
assert_equals(media_list.length, 1);
assert_equals(media_list.item(0), "all");
assert_equals(media_list.mediaText, "all");
}, "deleteMedium_removes_correct_medium",
{ assert: "MediaList.deleteMedium removes correct medium and updates corresponding properties." });
}, "deleteMedium_removes_correct_medium");

// MediaList.deleteMedium doesn't modify MediaList when medium is not found.
test(function() {
media_list = setup();

Expand All @@ -63,8 +64,7 @@
assert_equals(media_list.length, 1);
assert_equals(media_list.item(0), "all");
assert_equals(media_list.mediaText, "all");
}, "deleteMedium_no_matching_medium_to_remove",
{ assert: "MediaList.deleteMedium doesn't modify MediaList when medium is not found." });
}, "deleteMedium_no_matching_medium_to_remove");

</script>
</body>
Expand Down
Loading