https://github.com/web-platform-tests/wpt
Raw File
Tip revision: b8dcfbef3d702adeff8d33ed6e954c7303c91eb9 authored by Simon Pieters on 28 June 2018, 17:29:40 UTC
Lint that META.yml files exist
Tip revision: b8dcfbe
usbConnectionEvent.https.any.js
// META: script=/webusb/resources/fake-devices.js
// META: script=/webusb/resources/usb-helpers.js
// META: global=sharedworker

'use strict';

usb_test(() => getFakeDevice()
    .then(({ device }) => {
      let evt = new USBConnectionEvent('connect', { device: device });
      assert_equals(evt.type, 'connect');
      assert_equals(evt.device, device);
    }),
    'Can construct a USBConnectionEvent with a device');

test(t => {
  assert_throws(TypeError(),
      () => new USBConnectionEvent('connect', { device: null }));
  assert_throws(TypeError(),
      () => new USBConnectionEvent('connect', {}));
}, 'Cannot construct a USBConnectionEvent without a device');

done();
back to top