electron/spec/fixtures/pages/jquery.html
Micha Hanselmann 504edf2cf6 test: correct fake tests in api-protocol-spec (#18869)
* fix protocol 404 fake tests

* fix another fake test

* fix last fake test (hopefully)
2019-06-19 13:40:49 -07:00

22 lines
559 B
HTML

<html>
<head>
<script src="../../static/jquery-2.0.3.min.js"></script>
</head>
<body>
<script>
window.ajax = (url, options) => {
return new Promise((resolve, reject) => {
options.url = url
options.cache = false
options.success = (data, status, request) => {
resolve({data, status: request.status, headers: request.getAllResponseHeaders()})
}
options.error = (xhr, errorType, error) => {
reject(error ? error : new Error(`${xhr.status}`))
}
$.ajax(options)
})
}
</script>
</body>
</html>