begin making javascript interactive elements work headless

This commit is contained in:
John Bintz 2011-05-03 11:06:49 -04:00
parent ee8f8382cb
commit 7c6db7b036

View File

@ -36,6 +36,8 @@ signals:
void consoleLog(const QString &msg, int lineNumber, const QString &sourceID); void consoleLog(const QString &msg, int lineNumber, const QString &sourceID);
protected: protected:
void javaScriptConsoleMessage(const QString & message, int lineNumber, const QString & sourceID); void javaScriptConsoleMessage(const QString & message, int lineNumber, const QString & sourceID);
bool javaScriptConfirm(QWebFrame *frame, const QString &msg);
void javaScriptAlert(QWebFrame *frame, const QString &msg);
}; };
void HeadlessSpecRunnerPage::javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID) void HeadlessSpecRunnerPage::javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID)
@ -43,6 +45,19 @@ void HeadlessSpecRunnerPage::javaScriptConsoleMessage(const QString &message, in
emit consoleLog(message, lineNumber, sourceID); emit consoleLog(message, lineNumber, sourceID);
} }
bool HeadlessSpecRunnerPage::javaScriptConfirm(QWebFrame *frame, const QString &msg)
{
std::cout << "[TODO] ";
std::cout << "jasmine-headless-webkit can't handle confirm() yet! You should mock window.confirm for now. Returning true." << std::endl;
return true;
}
void HeadlessSpecRunnerPage::javaScriptAlert(QWebFrame *frame, const QString &msg)
{
std::cout << "[alert] ";
std::cout << qPrintable(msg) << std::endl;
}
class HeadlessSpecRunner: public QObject class HeadlessSpecRunner: public QObject
{ {
Q_OBJECT Q_OBJECT