more breakage
This commit is contained in:
parent
54e5d5c9d5
commit
7db116fb45
@ -4,26 +4,27 @@
|
|||||||
|
|
||||||
#include "Page.h"
|
#include "Page.h"
|
||||||
|
|
||||||
Page::Page() : QWebPage(), confirmResult(true) {}
|
Page::Page() : QWebPage(), confirmResult(true) {}
|
||||||
|
|
||||||
void Page::javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID) {
|
void Page::javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID) {
|
||||||
emit consoleLog(message, lineNumber, sourceID);
|
emit consoleLog(message, lineNumber, sourceID);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Page::javaScriptConfirm(QWebFrame*, const QString&) {
|
bool Page::javaScriptConfirm(QWebFrame*, const QString&) {
|
||||||
if (confirmResult) {
|
if (confirmResult) {
|
||||||
emit internalLog("TODO", "jasmine-headless-webkit can't handle confirm() yet! You should mock window.confirm for now. Returning true.");
|
emit internalLog("TODO", "jasmine-headless-webkit can't handle confirm() yet! You should mock window.confirm for now. Returning true.");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
confirmResult = true;
|
confirmResult = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Page::javaScriptAlert(QWebFrame*, const QString &msg) {
|
void Page::javaScriptAlert(QWebFrame*, const QString &msg) {
|
||||||
emit internalLog("alert", msg);
|
emit internalLog("alert", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Page::oneFalseConfirm() {
|
||||||
|
confirmResult = false;
|
||||||
|
}
|
||||||
|
|
||||||
void Page::oneFalseConfirm() {
|
|
||||||
confirmResult = false;
|
|
||||||
}
|
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
if window.JHW
|
||||||
|
window.console =
|
||||||
|
log: (data) ->
|
||||||
|
if typeof(jQuery) != 'undefined' && data instanceof jQuery
|
||||||
|
JHW.log(style_html($("<div />").append(data).html(), { indent_size: 2 }))
|
||||||
|
else
|
||||||
|
useJsDump = true
|
||||||
|
|
||||||
|
try
|
||||||
|
if typeof data.toJSON == 'function'
|
||||||
|
JHW.log("JSON: #{JSON.stringify(data, null, 2)}")
|
||||||
|
useJsDump = false
|
||||||
|
catch e
|
||||||
|
|
||||||
|
if useJsDump
|
||||||
|
dump = jsDump.doParse(data)
|
||||||
|
if dump.indexOf("\n") == -1
|
||||||
|
JHW.log(dump)
|
||||||
|
else
|
||||||
|
JHW.log("jsDump: #{dump}")
|
||||||
|
pp: (data) ->
|
||||||
|
JHW.log(if jasmine then jasmine.pp(data) else console.log(data))
|
||||||
|
peek: (data) ->
|
||||||
|
console.log(data)
|
||||||
|
data
|
||||||
|
|
||||||
|
window.onbeforeunload = (e) ->
|
||||||
|
JHW.leavePageAttempt()
|
||||||
|
|
||||||
|
JHW.stderr.puts('The code tried to leave the test page. Check for unhandled form submits and link clicks.')
|
||||||
|
|
||||||
|
if e = e || window.event
|
||||||
|
e.returnValue = "leaving"
|
||||||
|
|
||||||
|
return "leaving"
|
||||||
|
|
||||||
|
window.confirm = (message) ->
|
||||||
|
JHW.stderr.puts("jasmine-headless-webkit can't handle confirm() yet! You should mock window.confirm. Returning true.")
|
||||||
|
true
|
||||||
|
|
||||||
|
window.alert = (message) ->
|
||||||
|
JHW.stderr.puts(message)
|
||||||
|
|
||||||
|
JHW.error = (message, sourceUrl, lineNumber) ->
|
||||||
|
|
||||||
|
|
||||||
|
for handle in [ 'stdout', 'stderr', 'report' ]
|
||||||
|
JHW[handle] =
|
||||||
|
print: (content) -> JHW.print(handle, content)
|
||||||
|
puts: (content) -> JHW.print(handle, content + "\n")
|
||||||
|
|
||||||
|
JHW.log = (msg) ->
|
||||||
|
JHW.usedConsole()
|
||||||
|
JHW.stdout.puts(msg)
|
||||||
|
|
@ -16,7 +16,7 @@ module Jasmine::Headless
|
|||||||
|
|
||||||
class << self
|
class << self
|
||||||
def root
|
def root
|
||||||
@root ||= Pathname.new(File.expand_path('../../..', __FILE__))
|
@root ||= Pathname(File.expand_path('../../..', __FILE__))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -3,62 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
|
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
|
||||||
<title>Jasmine Test Runner - Generated by jasmine-headless-webkit</title>
|
<title>Jasmine Test Runner - Generated by jasmine-headless-webkit</title>
|
||||||
<script type="text/javascript"><%= File.read('
|
<script type="text/javascript" src="<%= Jasmine::Headless.root.join('jasmine/prolog.js') %>"</script>
|
||||||
if (window.JHW) {
|
|
||||||
window.console = { log: function(data) {
|
|
||||||
if (typeof(jQuery) !== 'undefined' && data instanceof jQuery) {
|
|
||||||
JHW.log(style_html($("<div />").append(data).html(), { indent_size: 2 }));
|
|
||||||
} else {
|
|
||||||
var usejsDump = true;
|
|
||||||
try {
|
|
||||||
if (typeof data.toJSON == 'function') {
|
|
||||||
JHW.log("JSON: " + JSON.stringify(data, null, 2));
|
|
||||||
usejsDump = false;
|
|
||||||
}
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
if (usejsDump) {
|
|
||||||
var dump = jsDump.doParse(data);
|
|
||||||
if (dump.indexOf("\\n") == -1) {
|
|
||||||
JHW.log(dump);
|
|
||||||
} else {
|
|
||||||
JHW.log("jsDump: " + dump);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, pp: function(data) {
|
|
||||||
JHW.log(jasmine ? jasmine.pp(data) : JSON.stringify(data));
|
|
||||||
}, peek: function(data) {
|
|
||||||
console.log(data);
|
|
||||||
return data;
|
|
||||||
} };
|
|
||||||
|
|
||||||
window.onbeforeunload = function(e) {
|
|
||||||
JHW.leavePageAttempt('The code tried to leave the test page. Check for unhandled form submits and link clicks.');
|
|
||||||
|
|
||||||
if (e = e || window.event) {
|
|
||||||
e.returnValue = "leaving";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "leaving";
|
|
||||||
};
|
|
||||||
|
|
||||||
JHW.stdout = {
|
|
||||||
print: function(content) { JHW.print('stdout', content); },
|
|
||||||
puts: function(content) { JHW.print('stdout', content + "\n"); }
|
|
||||||
};
|
|
||||||
|
|
||||||
JHW.report = {
|
|
||||||
print: function(content) { JHW.print('report', content); },
|
|
||||||
puts: function(content) { JHW.print('report', content + "\n"); }
|
|
||||||
};
|
|
||||||
|
|
||||||
JHW.log = function(msg) {
|
|
||||||
JHW.usedConsole();
|
|
||||||
JHW.stdout.puts(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<%= files.join("\n") %>
|
<%= files.join("\n") %>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
if (window.JHW) { HeadlessReporterResult.specLineNumbers = <%= MultiJson.encode(spec_lines) %>; }
|
if (window.JHW) { HeadlessReporterResult.specLineNumbers = <%= MultiJson.encode(spec_lines) %>; }
|
||||||
|
Loading…
Reference in New Issue
Block a user