Skip to content

Commit

Permalink
dropping unnecessary try usage, better testharness.js usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Hallvord R. M. Steen committed Jul 27, 2015
1 parent f675441 commit 68be7a9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@
return e.clipboardData.getData('text/plain')=='synthetic event text';
}
function onTestSetupReady(){
try{
var evt = new ClipboardEvent('paste')
evt.clipboardData.items.add('synthetic event text', 'text/plain');
document.dispatchEvent(evt);
}catch(e){
result('Unexpected Exception when initiating ClipboardEvent: '+e);
return;
}
var evt = new ClipboardEvent('paste')
evt.clipboardData.items.add('synthetic event text', 'text/plain');
document.dispatchEvent(evt);
}

</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@
}

function onTestSetupReady(){
try{
var evt = new ClipboardEvent('paste');
evt.clipboardData.items.add('synthetic event text', 'text/foobarbogustype');
document.dispatchEvent(evt);
}catch(e){
result('Unexpected Exception when initiating ClipboardEvent: '+e);
return;
}
var evt = new ClipboardEvent('paste');
evt.clipboardData.items.add('synthetic event text', 'text/foobarbogustype');
document.dispatchEvent(evt);
}

</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@
/* Events: paste */
/* paste data: "pasted text" */
function clipboard_api_test(e){
var passed=true;
try{
result(function(){
assert_throws(new TypeError, function(){
e.clipboardData.getData();
passed=false;
}catch(e){}
try{
});
/* assert_throws('TypeError', function(){
e.clipboardData.getData('text/plain', 'wrong number of arguments');
passed=false;
}catch(e){}
return passed;
});*/
});
}

</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@
//TODO: this test asserts a NOOP.
// how this SHOULD work is, however, underspecified..
function clipboard_api_test(e){
var passed = false;
try{
e.clipboardData.setData('text/foobarbogustype', 'copycutpaste modified text');
e.preventDefault();
passed=true;
}catch(e){
}
return passed;
e.clipboardData.setData('text/foobarbogustype', 'copycutpaste modified text');
e.preventDefault();
// pass condition is external, check clipboard contents
}

</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@
//TODO: this test asserts a NOOP.
// how this SHOULD work is, however, underspecified..
function clipboard_api_test(e){
var passed = false;
try{
e.clipboardData.setData('text/foobarbogustype', 'copycutpaste modified text');
e.preventDefault();
passed=true;
}catch(e){
}
return passed;
e.clipboardData.setData('text/foobarbogustype', 'copycutpaste modified text');
e.preventDefault();
// pass condition is external, check clipboard contents
}

</script>
Expand Down

0 comments on commit 68be7a9

Please sign in to comment.