<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../utils.js"></script>
<script>

'use strict';

target_test({ width: "200px", height: "200px" }, (target, test) => {
    document.body.style.width = "2000px";
    document.body.style.height = "2000px";

    target.style.touchAction = "pan-x";

    const eventTracker = new EventTracker(target, ["pointerdown", "pointerup", "pointercancel"]);

    const one = ui.finger();
    ui.sequence([
        one.begin({ x: 150, y: 150 }),
        one.move({ x: 149, y: 150 }),
        one.move({ x: 148, y: 150 }),
        one.move({ x: 120, y: 150 }),
        one.move({ x: 100, y: 150 }),
        one.end()
    ]).then(() => {
        eventTracker.assertMatchesEvents([
            { type: "pointerdown" },
            { type: "pointercancel" }
        ]);
        test.done();
    });
}, "Testing that panning in the x-axis on an element with touch-action: pan-x triggers a pointercancel event.");

</script>
</body>
</html>