[webkit-dev] PSA: consider using check-layout.js for layout patches
Ojan Vafai
ojan at chromium.org
Wed Oct 10 15:49:04 PDT 2012
check-layout.js allows you to easily write dumpAsText tests for layout
patches that assert sizing and positioning information.
Usage:
1. checkLayout(selector); // checks layout of all elements matching the
selector.
2. Use data-expected-* for the asserts. See
http://trac.webkit.org/browser/trunk/LayoutTests/resources/check-layout.js for
the full list of supported expected values. Feel free to add more here as
appropriate. This is just what we've needed so far for flexbox.
Here's an example:
<!DOCTYPE html>
<script src="path/to/LayoutTests/resources/check-layout.js"></script>
<div style="width: 100px">
<div class="box" style="width: 50%" data-expected-width=50></div>
<div class="box" style="width: 20%" data-expected-width=20></div>
</div>
<script>
checkLayout(".box");
</script>
This will spit out a text expected result of:
PASS
PASS
When a test fails, it will spit out the expected "FAIL: got ... expected
..." lines as well as the outerHTML of the failing element.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20121010/431bdb3e/attachment.html>
More information about the webkit-dev
mailing list