| <html> |
| <body> |
| <pre id="console"></pre> |
| <datagrid id="test"></datagrid> |
| <script> |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| function log(msg) |
| { |
| document.getElementById('console').appendChild(document.createTextNode(msg + "\n")); |
| } |
| |
| try { |
| |
| var datagrid = document.getElementById('test'); |
| |
| // Test setting the dataSource property and making sure the value of the property |
| // matches what we put in (using the === operator to check for exact equality.) |
| |
| // Test initial value. |
| if (datagrid.dataSource === null) { |
| log("PASS: Initial value of datagrid.dataSource is null."); |
| } else { |
| log("FAIL: Initial value of datagrid.dataSource was not null. Was " + datagrid.dataSource + "."); |
| } |
| |
| // Test setting to a JS number. |
| datagrid.dataSource = 10; |
| if (datagrid.dataSource === 10) { |
| log("PASS: Allowed setting datagrid.dataSource to a number."); |
| } else { |
| log("FAIL: Did not allow setting datagrid.dataSource to a number."); |
| } |
| |
| // Test setting to a JS number. |
| datagrid.dataSource = "Test String"; |
| if (datagrid.dataSource === "Test String") { |
| log("PASS: Allowed setting datagrid.dataSource to a string."); |
| } else { |
| log("FAIL: Did not allow setting datagrid.dataSource to a string."); |
| } |
| |
| // Test setting dataSource to an object. |
| var dataSource = {}; |
| datagrid.dataSource = dataSource; |
| if (datagrid.dataSource == dataSource) { |
| log("PASS: Allowed setting datagrid.dataSource to an object."); |
| } else { |
| log("FAIL: Did not allow setting datagrid.dataSource to an object."); |
| } |
| |
| // Test setting dataSource to null. |
| datagrid.dataSource = null; |
| if (datagrid.dataSource === null) { |
| log("PASS: Allowed setting datagrid.dataSource to null."); |
| } else { |
| log("FAIL: Did not allow setting datagrid.dataSource to null."); |
| } |
| |
| } catch (exception) { |
| log("FAIL: Threw exception " + exception); |
| } |
| </script> |
| </body> |
| </html> |