mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
Use offline app cache support when ./tmp/ exists
In Rails projects it's a sure bet that tmp exists so this automatically covers most people. With the README addition other people know to create the directory.
This commit is contained in:
parent
51b68f34d3
commit
a9073703dd
2 changed files with 12 additions and 2 deletions
|
@ -76,6 +76,13 @@ If you're using capybara-webkit with Sinatra, don't forget to set
|
||||||
Capybara.app = MySinatraApp.new
|
Capybara.app = MySinatraApp.new
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Offline Application Cache
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
The offline application cache needs a directory to write to for the cached files. Capybara-webkit
|
||||||
|
will look at if the working directory has a tmp directory and when it exists offline application
|
||||||
|
cache will be enabled.
|
||||||
|
|
||||||
Non-Standard Driver Methods
|
Non-Standard Driver Methods
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,11 @@ WebPage::WebPage(WebPageManager *manager, QObject *parent) : QWebPage(parent) {
|
||||||
settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
|
settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
|
||||||
settings()->setAttribute(QWebSettings::JavascriptCanCloseWindows, true);
|
settings()->setAttribute(QWebSettings::JavascriptCanCloseWindows, true);
|
||||||
settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
|
settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
|
||||||
|
|
||||||
|
if(QFileInfo("tmp").isDir()) {
|
||||||
settings()->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
|
settings()->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
|
||||||
settings()->setOfflineWebApplicationCachePath("tmp");
|
settings()->setOfflineWebApplicationCachePath("tmp");
|
||||||
|
}
|
||||||
|
|
||||||
createWindow();
|
createWindow();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue