diff options
Diffstat (limited to 'testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-return-value.html')
-rw-r--r-- | testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-return-value.html | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-return-value.html b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-return-value.html new file mode 100644 index 0000000000..2a80de65a1 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-return-value.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<html> +<head> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<dialog></dialog> +<script> +test(function() { + dialog = document.querySelector('dialog'); + assert_equals(dialog.returnValue, ''); + + dialog.returnValue = 'Setting value directly'; + assert_equals(dialog.returnValue, 'Setting value directly'); + + dialog.returnValue = null; + assert_equals(dialog.returnValue, 'null'); + + dialog.returnValue = ''; + assert_equals(dialog.returnValue, ''); + + dialog.returnValue = 7; + assert_equals(dialog.returnValue, '7'); + + dialog.show(); + dialog.close('Return value set from close()'); + assert_equals(dialog.returnValue, 'Return value set from close()'); + + dialog.show(); + dialog.close(''); + assert_equals(dialog.returnValue, ''); + + dialog.show(); + dialog.close(null); + assert_equals(dialog.returnValue, 'null'); + + dialog.returnValue = 'Should not change because no argument to close()'; + dialog.show(); + dialog.close(); + assert_equals(dialog.returnValue, 'Should not change because no argument to close()'); + + dialog.returnValue = 'Should not change because of undefined argument to close()'; + dialog.show(); + dialog.close(undefined); + assert_equals(dialog.returnValue, 'Should not change because of undefined argument to close()'); + + dialog.returnValue = 'Should not change because of no-op close()'; + dialog.close('blah'); + assert_equals(dialog.returnValue, 'Should not change because of no-op close()'); +}, "Tests dialog.returnValue is settable and returns the last value set."); +</script> +</body> +</html> |