| Index: LayoutTests/fast/events/constructors/clipboard-event-constructor.html
|
| diff --git a/LayoutTests/fast/events/constructors/clipboard-event-constructor.html b/LayoutTests/fast/events/constructors/clipboard-event-constructor.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..56c3b06db7b650e6629a8c03c5f354f1b8875983
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/events/constructors/clipboard-event-constructor.html
|
| @@ -0,0 +1,59 @@
|
| +<!DOCTYPE html>
|
| +<script src="../../../resources/js-test.js"></script>
|
| +<body>
|
| +<script>
|
| +description("This tests the constructor for the ClipboardEvent DOM class.");
|
| +
|
| +//No Initializer is passed
|
| +shouldBe("new ClipboardEvent('eventType').bubbles", "false");
|
| +shouldBe("new ClipboardEvent('eventType').cancelable", "false");
|
| +
|
| +// bubbles is passed.
|
| +shouldBe("new ClipboardEvent('eventType', { bubbles: false }).bubbles", "false");
|
| +shouldBe("new ClipboardEvent('eventType', { bubbles: true }).bubbles", "true");
|
| +
|
| +// cancelable is passed.
|
| +shouldBe("new ClipboardEvent('eventType', { cancelable: false }).cancelable", "false");
|
| +shouldBe("new ClipboardEvent('eventType', { cancelable: true }).cancelable", "true");
|
| +
|
| +//text data is passed
|
| +shouldBeEqualToString("new ClipboardEvent('cut', { data: 'hellodata', dataType: 'text' }).clipboardData.getData('text')", "hellodata");
|
| +shouldBeEqualToString("new ClipboardEvent('copy', { data: 'hellodata', dataType: 'text' }).clipboardData.getData('text')", "hellodata");
|
| +shouldBeEqualToString("new ClipboardEvent('paste', { data: 'hellodata', dataType: 'text' }).clipboardData.getData('text')", "hellodata");
|
| +
|
| +//url data is passed
|
| +shouldBeEqualToString("new ClipboardEvent('cut', { data: 'http://www.google.com/', dataType: 'url' }).clipboardData.getData('url')", "http://www.google.com/");
|
| +shouldBeEqualToString("new ClipboardEvent('copy', { data: 'http://www.google.com/', dataType: 'url' }).clipboardData.getData('url')", "http://www.google.com/");
|
| +shouldBeEqualToString("new ClipboardEvent('paste', { data: 'http://www.google.com/', dataType: 'url' }).clipboardData.getData('url')", "http://www.google.com/");
|
| +
|
| +//html data is passed
|
| +shouldBeEqualToString("new ClipboardEvent('cut', { data: '<em>Markup</em>', dataType: 'html' }).clipboardData.getData('html')", "<em>Markup</em>");
|
| +shouldBeEqualToString("new ClipboardEvent('copy', { data: '<em>Markup</em>', dataType: 'html' }).clipboardData.getData('html')", "<em>Markup</em>");
|
| +shouldBeEqualToString("new ClipboardEvent('paste', { data: '<em>Markup</em>', dataType: 'html' }).clipboardData.getData('html')", "<em>Markup</em>");
|
| +
|
| +//no dataType is passed
|
| +shouldBeEqualToString("new ClipboardEvent('copy', { data: '<em>Markup</em>'}).clipboardData.getData('html')", "");
|
| +shouldBeEqualToString("new ClipboardEvent('copy', { data: '<em>Markup</em>'}).clipboardData.getData('html')", "");
|
| +
|
| +// Non-strings.
|
| +shouldBeEqualToString("new ClipboardEvent('copy', { data: undefined, dataType: 'text' }).clipboardData.getData('text')", "");
|
| +shouldBeEqualToString("new ClipboardEvent('copy', { data: null, dataType: 'text' }).clipboardData.getData('text')", "null");
|
| +shouldBeEqualToString("new ClipboardEvent('copy', { data: false, dataType: 'text' }).clipboardData.getData('text')", "false");
|
| +shouldBeEqualToString("new ClipboardEvent('copy', { data: true, dataType: 'text' }).clipboardData.getData('text')", "true");
|
| +shouldBeEqualToString("new ClipboardEvent('copy', { data: 12345, dataType: 'text' }).clipboardData.getData('text')", "12345");
|
| +shouldBeEqualToString("new ClipboardEvent('copy', { data: 18446744073709551615, dataType: 'text' }).clipboardData.getData('text')", "18446744073709552000");
|
| +shouldBeEqualToString("new ClipboardEvent('copy', { data: NaN, dataType: 'text' }).clipboardData.getData('text')", "NaN");
|
| +shouldBeEqualToString("new ClipboardEvent('copy', { data: [], dataType: 'text' }).clipboardData.getData('text')", "");
|
| +shouldBeEqualToString("new ClipboardEvent('copy', { data: [1, 2, 3], dataType: 'text' }).clipboardData.getData('text')", "1,2,3");
|
| +
|
| +// All initializers are passed.
|
| +shouldBe("new ClipboardEvent('eventType', { bubbles: true, cancelable: true, data: 'http://www.google.com/', dataType: 'url' }).bubbles", "true");
|
| +shouldBe("new ClipboardEvent('eventType', { bubbles: true, cancelable: true, data: 'http://www.google.com/', dataType: 'url' }).cancelable", "true");
|
| +shouldBeEqualToString("new ClipboardEvent('copy', { bubbles: true, cancelable: true, data: 'http://www.google.com/', dataType: 'url' }).clipboardData.getData('url')", "http://www.google.com/");
|
| +
|
| +//invalid eventType
|
| +shouldBeEqualToString("new ClipboardEvent('invalid', { bubbles: true, cancelable: true, data: 'http://www.google.com/', dataType: 'url' }).clipboardData.getData('url')", "");
|
| +//no eventType specified
|
| +shouldBeEqualToString("new ClipboardEvent({ bubbles: true, cancelable: true, data: 'http://www.google.com/', dataType: 'url' }).clipboardData.getData('url')", "");
|
| +</script>
|
| +</body>
|
|
|