This commit is contained in:
Florian Bruhin 2016-03-29 23:19:58 +02:00
parent 8a1d45210c
commit 5a5e8167dd
2 changed files with 5 additions and 5 deletions

View File

@ -219,7 +219,7 @@ def qnam(qapp):
@pytest.fixture
def webengineview():
"""Get a QWebEngineView if QtWebEngine is available"""
"""Get a QWebEngineView if QtWebEngine is available."""
if QtWebEngineWidgets is None:
pytest.skip("QtWebEngine unavailable")
return QtWebEngineWidgets.QWebEngineView()

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Check how Qt behaves when trying to execute JS"""
"""Check how Qt behaves when trying to execute JS."""
import pytest
@ -49,7 +49,7 @@ class WebEngineJSChecker(QObject):
@pytest.mark.parametrize('js_enabled, expected', [(True, 2.0), (False, None)])
def test_simple_js_webkit(webview, js_enabled, expected):
"""With QtWebKit, evaluateJavaScript works when JS is on"""
"""With QtWebKit, evaluateJavaScript works when JS is on."""
webview.settings().setAttribute(QWebSettings.JavascriptEnabled, js_enabled)
result = webview.page().mainFrame().evaluateJavaScript('1 + 1')
assert result == expected
@ -57,7 +57,7 @@ def test_simple_js_webkit(webview, js_enabled, expected):
@pytest.mark.parametrize('js_enabled, expected', [(True, 2.0), (False, 2.0)])
def test_element_js_webkit(webview, js_enabled, expected):
"""With QtWebKit, evaluateJavaScript on an element works with JS off"""
"""With QtWebKit, evaluateJavaScript on an element works with JS off."""
webview.settings().setAttribute(QWebSettings.JavascriptEnabled, js_enabled)
elem = webview.page().mainFrame().documentElement()
result = elem.evaluateJavaScript('1 + 1')
@ -66,7 +66,7 @@ def test_element_js_webkit(webview, js_enabled, expected):
@pytest.mark.parametrize('js_enabled, expected', [(True, 2.0), (False, 2.0)])
def test_simple_js_webengine(qtbot, webengineview, js_enabled, expected):
"""With QtWebEngine, runJavaScript works even when JS is off"""
"""With QtWebEngine, runJavaScript works even when JS is off."""
# pylint: disable=no-name-in-module
# If we get there (because of the webengineview fixture) we can be certain
# QtWebEngine is available