Replace two composer IPC calls for indenting with a single one.
* src/client/composer/composer-web-view.vala (ClientWebView): Replace ::undo_blockquote_style with ::indent_line. * src/client/composer/composer-widget.vala (ComposerWidget::on_indent): Call new ::indent_line method, rather than doing a execCommand and a second JS thunking call to fix the markup. * ui/composer-web-view.js: Also replace ::undoBlockquoteStyle with new ::indentLine method. Add unit test.
This commit is contained in:
parent
e06a73ebd6
commit
e22ece508c
4 changed files with 37 additions and 19 deletions
|
|
@ -11,6 +11,7 @@ class ComposerPageStateTest : ClientWebViewTestCase<ComposerWebView> {
|
|||
base("ComposerPageStateTest");
|
||||
add_test("edit_context_font", edit_context_font);
|
||||
add_test("edit_context_link", edit_context_link);
|
||||
add_test("indent_line", indent_line);
|
||||
add_test("contains_attachment_keywords", contains_attachment_keywords);
|
||||
add_test("get_html", get_html);
|
||||
add_test("get_text", get_text);
|
||||
|
|
@ -54,6 +55,23 @@ class ComposerPageStateTest : ClientWebViewTestCase<ComposerWebView> {
|
|||
}
|
||||
}
|
||||
|
||||
public void indent_line() {
|
||||
load_body_fixture("""<span id="test">some text</span>""");
|
||||
try {
|
||||
run_javascript(@"SelectionUtil.selectNode(document.getElementById('test'))");
|
||||
run_javascript(@"geary.indentLine()");
|
||||
assert(WebKitUtil.to_number(run_javascript(@"document.querySelectorAll('blockquote[type=cite]').length")) == 1);
|
||||
assert(WebKitUtil.to_string(run_javascript(@"document.querySelectorAll('blockquote[type=cite]').item(0).innerText")) ==
|
||||
"some text");
|
||||
} catch (Geary.JS.Error err) {
|
||||
print("Geary.JS.Error: %s\n", err.message);
|
||||
assert_not_reached();
|
||||
} catch (Error err) {
|
||||
print("WKError: %s\n", err.message);
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
public void contains_attachment_keywords() {
|
||||
load_body_fixture("""
|
||||
<blockquote>inner quote</blockquote>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue