Merge branch 'paretje-insert-text-js'
This commit is contained in:
commit
f9c35329df
@ -156,9 +156,9 @@ Contributors, sorted by the number of commits in descending order:
|
|||||||
* Felix Van der Jeugt
|
* Felix Van der Jeugt
|
||||||
* Martin Tournoij
|
* Martin Tournoij
|
||||||
* Raphael Pierzina
|
* Raphael Pierzina
|
||||||
|
* Kevin Velghe
|
||||||
* Joel Torstensson
|
* Joel Torstensson
|
||||||
* Patric Schmitz
|
* Patric Schmitz
|
||||||
* Kevin Velghe
|
|
||||||
* Tarcisio Fedrizzi
|
* Tarcisio Fedrizzi
|
||||||
* Claude
|
* Claude
|
||||||
* Corentin Julé
|
* Corentin Julé
|
||||||
|
@ -761,10 +761,6 @@ class AbstractTab(QWidget):
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def has_js(self):
|
|
||||||
"""Check if qutebrowser can run javascript in this tab."""
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
@ -1539,8 +1539,6 @@ class CommandDispatcher:
|
|||||||
text: The text to insert.
|
text: The text to insert.
|
||||||
"""
|
"""
|
||||||
tab = self._current_widget()
|
tab = self._current_widget()
|
||||||
if not tab.has_js():
|
|
||||||
raise cmdexc.CommandError("This command needs javascript enabled.")
|
|
||||||
|
|
||||||
def _insert_text_cb(elem):
|
def _insert_text_cb(elem):
|
||||||
if elem is None:
|
if elem is None:
|
||||||
|
@ -528,10 +528,6 @@ class WebEngineTab(browsertab.AbstractTab):
|
|||||||
else:
|
else:
|
||||||
self._widget.page().runJavaScript(code, callback)
|
self._widget.page().runJavaScript(code, callback)
|
||||||
|
|
||||||
def has_js(self):
|
|
||||||
# QtWebEngine can run JS even if the page can't
|
|
||||||
return True
|
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
log.stub()
|
log.stub()
|
||||||
|
|
||||||
|
@ -629,10 +629,6 @@ class WebKitTab(browsertab.AbstractTab):
|
|||||||
if callback is not None:
|
if callback is not None:
|
||||||
callback(result)
|
callback(result)
|
||||||
|
|
||||||
def has_js(self):
|
|
||||||
settings = QWebSettings.globalSettings()
|
|
||||||
return settings.testAttribute(QWebSettings.JavascriptEnabled)
|
|
||||||
|
|
||||||
def icon(self):
|
def icon(self):
|
||||||
return self._widget.icon()
|
return self._widget.icon()
|
||||||
|
|
||||||
|
@ -256,6 +256,19 @@ Feature: Yanking and pasting.
|
|||||||
# Compare
|
# Compare
|
||||||
Then the javascript message "textarea contents: Hello world" should be logged
|
Then the javascript message "textarea contents: Hello world" should be logged
|
||||||
|
|
||||||
|
Scenario: Inserting text into an empty text field with javascript disabled
|
||||||
|
When I set general -> log-javascript-console to info
|
||||||
|
And I set content -> allow-javascript to false
|
||||||
|
And I open data/paste_primary.html
|
||||||
|
And I run :click-element id qute-textarea
|
||||||
|
And I wait for "Clicked editable element!" in the log
|
||||||
|
And I run :insert-text Hello world
|
||||||
|
And I press the keys "<Ctrl+a>"
|
||||||
|
And I run :yank selection
|
||||||
|
And I set content -> allow-javascript to true
|
||||||
|
# Compare
|
||||||
|
Then the clipboard should contain "Hello world"
|
||||||
|
|
||||||
Scenario: Inserting text into a text field at specific position
|
Scenario: Inserting text into a text field at specific position
|
||||||
When I set general -> log-javascript-console to info
|
When I set general -> log-javascript-console to info
|
||||||
And I open data/paste_primary.html
|
And I open data/paste_primary.html
|
||||||
|
Loading…
Reference in New Issue
Block a user