Changes between Version 4 and Version 5 of Writing testharness Tests


Ignore:
Timestamp:
Sep 6, 2020 8:11:51 PM (13 months ago)
Author:
Fujii Hironori
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Writing testharness Tests

    v4 v5  
    1515
    1616NOTE: When copying tests from the WebKit repository to W3C, the path to these two scripts will need to be updated.  In the W3C repository the scripts are located in a resources folder at the root level, i.e.: /resources/testharness.js and /resources/testharnessreport.js
     17
     18== An example of js-test.js test ==
     19
     20{{{
     21<!DOCTYPE html>
     22<html>
     23<head>
     24<script src="../../resources/js-test.js"></script>
     25<script>
     26description("Test a class selector for <a href=\"http://webkit.org/b/XXXX\">Bug XXXX</a>: WebKit does not apply class-selector");
     27jsTestIsAsync = true;
     28
     29onload = ()=>
     30{
     31    const block = document.getElementsByClassName('block')[0];
     32    color = document.defaultView.getComputedStyle(block, null).getPropertyValue('color');
     33    shouldBeEqualToString("color", 'rgb(0, 128, 0)');
     34    finishJSTest();
     35
     36}
     37</script>
     38<style>
     39    .block { color: green; }
     40</style>
     41</head>
     42<body>
     43<p class="block"></p>
     44</body>
     45</html>
     46}}}