diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/resources/javascript/document_methods.in | 53 | ||||
-rw-r--r-- | testing/resources/javascript/document_methods_expected.txt | 16 |
2 files changed, 53 insertions, 16 deletions
diff --git a/testing/resources/javascript/document_methods.in b/testing/resources/javascript/document_methods.in index 66d5484f67..0188d7c237 100644 --- a/testing/resources/javascript/document_methods.in +++ b/testing/resources/javascript/document_methods.in @@ -187,7 +187,11 @@ function testGetNthFieldName() { // Argument can not be negative. expectError('this.getNthFieldName(-1)'); - // TODO(tsepez): test success cases. + // Argument can not be huge. + expectError('this.getNthFieldName(400000)'); + + // TODO(tsepez): add field object so this case works. + expectError('this.getNthFieldName(0)'); } function testGetPageNthWord() { @@ -229,29 +233,37 @@ function testGetPageNumWords() { } function testGetPrintParams() { - // Method is present. - expect('typeof this.getPrintParams', 'function'); + // Method is present. + expect('typeof this.getPrintParams', 'function'); - // TODO(tsepez): test success cases. + // Method always returns in error. + expectError('this.getPrintParams()'); + expectError('this.getPrintParams(42)'); } function testGotoNamedDest() { - // Method is present. - expect('typeof this.gotoNamedDest', 'function'); + // Method is present. + expect('typeof this.gotoNamedDest', 'function'); - // Method needs exactly one argument. - expectError('this.gotoNamedDest()'); - expectError('this.gotoNamedDest(1, 2)'); + // Method needs exactly one argument. + expectError('this.gotoNamedDest()'); + expectError('this.gotoNamedDest(1, 2)'); - // TODO(tonikitoo): test success cases. + // TODO(tsepez): add actual named dest matching this. + expectError('this.gotoNamedDest("chicago")'); } function testMailDoc() { - // Method is present. - expect('typeof this.mailDoc', 'function'); + // Method is present. + expect('typeof this.mailDoc', 'function'); // TODO(tsepez): test with no permissions. - // TODO(tsepez): test success cases. + + // Success cases. + expect('this.mailDoc(true)', undefined); + expect('this.mailDoc(false, "user@example.com", "cc@example.com", ' + + '"bcc@example.com", "Lottery Winner", "You won the lottery!")', + undefined); } function testMailForm() { @@ -259,7 +271,12 @@ function testMailForm() { expect('typeof this.mailForm', 'function'); // TODO(tsepez): test with no permissions. - // TODO(tsepez): test success cases. + + // Success cases. + expect('this.mailForm(true)', undefined); + expect('this.mailForm(false, "user@example.com", "cc@example.com", ' + + '"bcc@example.com", "Lottery Winner", "You won the lottery!")', + undefined); } function testPrint() { @@ -285,7 +302,10 @@ function testResetForm() { expect('typeof this.resetForm', 'function'); // TODO(tsepez): test with no permissions. - // TODO(tsepez): test success cases. + + // TODO(tsepez): Add form to document to match these arguments. + expect('this.resetForm()', undefined); + expect('this.resetForm("myform")', undefined); } function testSubmitForm() { @@ -295,7 +315,8 @@ function testSubmitForm() { // Method requires at least one argument. expectError('this.submitForm()'); - // TODO(tsepez): test success cases. + // TODO(tsepez): Add form to document to match these arguments. + expect('this.submitForm("myform", true, true, ["name", "age"])', undefined); } try { diff --git a/testing/resources/javascript/document_methods_expected.txt b/testing/resources/javascript/document_methods_expected.txt index 4a2c4d7ee6..01bf0ed0bd 100644 --- a/testing/resources/javascript/document_methods_expected.txt +++ b/testing/resources/javascript/document_methods_expected.txt @@ -89,6 +89,8 @@ Alert: PASS: this.getIcon(1, 2) threw error Document.getIcon: Incorrect number o Alert: PASS: typeof this.getNthFieldName = function Alert: PASS: this.getNthFieldName() threw error Document.getNthFieldName: Incorrect number of parameters passed to function. Alert: PASS: this.getNthFieldName(-1) threw error Document.getNthFieldName: Incorrect parameter value. +Alert: PASS: this.getNthFieldName(400000) threw error Document.getNthFieldName: Object no longer exists. +Alert: PASS: this.getNthFieldName(0) threw error Document.getNthFieldName: Object no longer exists. Alert: PASS: typeof this.getPageNthWord = function Alert: PASS: this.getPageNthWord(0, 0, true, "clams", [1, 2]) = Hello, Alert: PASS: this.getPageNthWord(-1, 0, true) threw error Document.getPageNthWord: Incorrect parameter value. @@ -99,14 +101,28 @@ Alert: PASS: this.getPageNumWords(0, "clams", [1, 2]) = 2 Alert: PASS: this.getPageNumWords(-1) threw error Document.getPageNumWords: Incorrect parameter value. Alert: PASS: this.getPageNumWords(6) threw error Document.getPageNumWords: Incorrect parameter value. Alert: PASS: typeof this.getPrintParams = function +Alert: PASS: this.getPrintParams() threw error Document.getPrintParams: Operation not supported. +Alert: PASS: this.getPrintParams(42) threw error Document.getPrintParams: Operation not supported. Alert: PASS: typeof this.gotoNamedDest = function Alert: PASS: this.gotoNamedDest() threw error Document.gotoNamedDest: Incorrect number of parameters passed to function. Alert: PASS: this.gotoNamedDest(1, 2) threw error Document.gotoNamedDest: Incorrect number of parameters passed to function. +Alert: PASS: this.gotoNamedDest("chicago") threw error Document.gotoNamedDest: Object no longer exists. Alert: PASS: typeof this.mailDoc = function +Mail Msg: 1, to=, cc=, bcc=, subject=, body= +Alert: PASS: this.mailDoc(true) = undefined +Mail Msg: 0, to=user@example.com, cc=cc@example.com, bcc=bcc@example.com, subject=Lottery Winner, body=You won the lottery! +Alert: PASS: this.mailDoc(false, "user@example.com", "cc@example.com", "bcc@example.com", "Lottery Winner", "You won the lottery!") = undefined Alert: PASS: typeof this.mailForm = function +Mail Msg: 1, to=, cc=, bcc=, subject=, body= +Alert: PASS: this.mailForm(true) = undefined +Mail Msg: 0, to=user@example.com, cc=cc@example.com, bcc=bcc@example.com, subject=Lottery Winner, body=You won the lottery! +Alert: PASS: this.mailForm(false, "user@example.com", "cc@example.com", "bcc@example.com", "Lottery Winner", "You won the lottery!") = undefined Alert: PASS: typeof this.print = function Alert: PASS: typeof this.removeField = function Alert: PASS: this.removeField() threw error Document.removeField: Incorrect number of parameters passed to function. Alert: PASS: typeof this.resetForm = function +Alert: PASS: this.resetForm() = undefined +Alert: PASS: this.resetForm("myform") = undefined Alert: PASS: typeof this.submitForm = function Alert: PASS: this.submitForm() threw error Document.submitForm: Incorrect number of parameters passed to function. +Alert: PASS: this.submitForm("myform", true, true, ["name", "age"]) = undefined |