Files
cefsharp/CefSharp.Example/Resources/BindingTest.html
T
Timo Tijhof d06d5100be Example - Simplify BindObjectAsync tests with QUnit (#3298)
* Example - Update to QUnit 2.10

Follows ae41e10d71, which introduced a few references
to QUnit 2.10.

* Example - Simplify the BindObjectAsync unit tests

The `QUnit.test()` may take an async function and/or to return a Promise.
This uses JavaScript's native async/await capabilities to wait for that,
much the same way manual tracking via `assert.async()` would.
Using this can simplify the test structures by a lot.

`assert.rejects()` asserts that a promise throws an error.
`assert.throws()` asserts that a block directly throws an error.

I've also tried to use `assert.deepEqual()`. I suspect a copy
of this function was placed here directly, but I couldn't find
in the history why, so perhaps worth trying if the built-in
one now works.
2020-12-16 10:59:23 +10:00

36 lines
950 B
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Binding Test</title>
<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.10.0.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="https://code.jquery.com/qunit/qunit-2.10.0.js"></script>
<!--<script type="text/javascript">
(async function() {
// <embed user provided code here>
await CefSharp.BindObjectAsync("boundAsync", "bound");
})();
(async () => {
await CefSharp.BindObjectAsync("boundAsync", "bound");
})();
</script>-->
<script src="BindingTestSync.js"></script>
<script src="BindingTestAsync.js"></script>
<script type="text/javascript">
QUnit.done(function (details)
{
CefSharp.PostMessage({ "Type": "QUnitExecutionComplete", "Details": details });
});
</script>
</body>
</html>