Fix non-breaking spaces breaking formatting in sent messages.
This ensures that non-breaking space chars (not HTML entities) are removed from text obtainined from the composer, and moves the F=F text formatting from JS back to Vala, to minimimse the JS footprint and return to using the old (working) version again. * src/client/composer/composer-web-view.vala (ClientWebView::get_text): Restore the old F=F formatting code previously in webkit-util, apply it to plain text obtained from the composer. * test/client/components/client-web-view-test-case.vala: New base class for tests involving ClientWebView. * test/client/composer/composer-web-view-test.vala: New tests for ComposerWebView::get_html and ::get_text. * test/js/composer-page-state-test.vala: Reworked to use ClientWebViewTestCase, updated tests now that JS is returning QUOTE_MARKER-delinated text, not F=F text. * test/testcase.vala (TestCase): Move ::async_complete and ::async_result from ComposerPageStateTest so all test cases can test async code. * test/CMakeLists.txt: Add new source files. * test/main.vala (main): Add new test. * ui/composer-web-view.js: Update doc comments, remove F=F code, break out non-breaking space replacement so it can be tested.
This commit is contained in:
parent
57f10446a9
commit
17fda41b85
8 changed files with 341 additions and 99 deletions
39
test/client/components/client-web-view-test-case.vala
Normal file
39
test/client/components/client-web-view-test-case.vala
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright 2016 Michael Gratton <mike@vee.net>
|
||||
*
|
||||
* This software is licensed under the GNU Lesser General Public License
|
||||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
// Defined by CMake build script.
|
||||
extern const string _BUILD_ROOT_DIR;
|
||||
|
||||
public abstract class ClientWebViewTestCase<V> : Gee.TestCase {
|
||||
|
||||
protected V test_view = null;
|
||||
|
||||
public ClientWebViewTestCase(string name) {
|
||||
base(name);
|
||||
}
|
||||
|
||||
public override void set_up() {
|
||||
ClientWebView.init_web_context(File.new_for_path(_BUILD_ROOT_DIR).get_child("src"), true);
|
||||
try {
|
||||
ClientWebView.load_scripts();
|
||||
} catch (Error err) {
|
||||
assert_not_reached();
|
||||
}
|
||||
this.test_view = set_up_test_view();
|
||||
}
|
||||
|
||||
protected abstract V set_up_test_view();
|
||||
|
||||
protected virtual void load_body_fixture(string? html = null) {
|
||||
ClientWebView client_view = (ClientWebView) this.test_view;
|
||||
client_view.load_html(html);
|
||||
while (client_view.is_loading) {
|
||||
Gtk.main_iteration();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue