<script src="../testing.js"></script>

<script id=abortController>
  var a1 = new AbortController();

  var s1 = a1.signal;
  testing.expectEqual(undefined, s1.throwIfAborted());
  testing.expectEqual(undefined, s1.reason);

  let target;;
  let called = 0;
  s1.addEventListener('abort', (e) => {
    called += 1;
    target = e.target;
  });

  a1.abort();
  testing.expectEqual(true, s1.aborted)
  testing.expectEqual(s1, target)
  testing.expectEqual('AbortError', s1.reason)
  testing.expectEqual(1, called)