Move WebKitUtil namespace to Util.WebKit
This commit is contained in:
parent
cfd1a61830
commit
f14b16fe7a
6 changed files with 51 additions and 51 deletions
|
|
@ -38,7 +38,7 @@ class ComposerPageStateTest : ClientWebViewTestCase<ComposerWebView> {
|
|||
load_body_fixture(html);
|
||||
|
||||
try {
|
||||
assert(WebKitUtil.to_string(run_javascript(@"new EditContext(document.getElementById('test')).encode()"))
|
||||
assert(Util.WebKit.to_string(run_javascript(@"new EditContext(document.getElementById('test')).encode()"))
|
||||
.has_prefix("1,url,"));
|
||||
} catch (Geary.JS.Error err) {
|
||||
print("Geary.JS.Error: %s\n", err.message);
|
||||
|
|
@ -54,7 +54,7 @@ class ComposerPageStateTest : ClientWebViewTestCase<ComposerWebView> {
|
|||
load_body_fixture(html);
|
||||
|
||||
try {
|
||||
assert(WebKitUtil.to_string(run_javascript(@"new EditContext(document.getElementById('test')).encode()")) ==
|
||||
assert(Util.WebKit.to_string(run_javascript(@"new EditContext(document.getElementById('test')).encode()")) ==
|
||||
"0,,Comic Sans,144");
|
||||
} catch (Geary.JS.Error err) {
|
||||
print("Geary.JS.Error: %s\n", err.message);
|
||||
|
|
@ -70,8 +70,8 @@ class ComposerPageStateTest : ClientWebViewTestCase<ComposerWebView> {
|
|||
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")) ==
|
||||
assert(Util.WebKit.to_number(run_javascript(@"document.querySelectorAll('blockquote[type=cite]').length")) == 1);
|
||||
assert(Util.WebKit.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);
|
||||
|
|
@ -94,16 +94,16 @@ some text
|
|||
true
|
||||
);
|
||||
try {
|
||||
assert(WebKitUtil.to_bool(run_javascript(
|
||||
assert(Util.WebKit.to_bool(run_javascript(
|
||||
@"geary.containsAttachmentKeyword(\"some\", \"subject text\");"
|
||||
)));
|
||||
assert(WebKitUtil.to_bool(run_javascript(
|
||||
assert(Util.WebKit.to_bool(run_javascript(
|
||||
@"geary.containsAttachmentKeyword(\"subject\", \"subject text\");"
|
||||
)));
|
||||
assert(!WebKitUtil.to_bool(run_javascript(
|
||||
assert(!Util.WebKit.to_bool(run_javascript(
|
||||
@"geary.containsAttachmentKeyword(\"innerquote\", \"subject text\");"
|
||||
)));
|
||||
assert(!WebKitUtil.to_bool(run_javascript(
|
||||
assert(!Util.WebKit.to_bool(run_javascript(
|
||||
@"geary.containsAttachmentKeyword(\"outerquote\", \"subject text\");"
|
||||
)));
|
||||
} catch (Geary.JS.Error err) {
|
||||
|
|
@ -143,7 +143,7 @@ unknown://example6.com
|
|||
|
||||
try {
|
||||
run_javascript("geary.cleanContent();");
|
||||
assert(WebKitUtil.to_string(run_javascript("geary.bodyPart.innerHTML;")) ==
|
||||
assert(Util.WebKit.to_string(run_javascript("geary.bodyPart.innerHTML;")) ==
|
||||
CLEAN_BODY_TEMPLATE.printf(expected));
|
||||
} catch (Geary.JS.Error err) {
|
||||
print("Geary.JS.Error: %s\n", err.message);
|
||||
|
|
@ -158,7 +158,7 @@ unknown://example6.com
|
|||
string html = "<p>para</p>";
|
||||
load_body_fixture(html);
|
||||
try {
|
||||
assert(WebKitUtil.to_string(run_javascript(@"window.geary.getHtml();")) ==
|
||||
assert(Util.WebKit.to_string(run_javascript(@"window.geary.getHtml();")) ==
|
||||
COMPLETE_BODY_TEMPLATE.printf(html));
|
||||
} catch (Geary.JS.Error err) {
|
||||
print("Geary.JS.Error: %s\n", err.message);
|
||||
|
|
@ -172,7 +172,7 @@ unknown://example6.com
|
|||
public void get_text() throws Error {
|
||||
load_body_fixture("<p>para</p>");
|
||||
try {
|
||||
assert(WebKitUtil.to_string(run_javascript(@"window.geary.getText();")) ==
|
||||
assert(Util.WebKit.to_string(run_javascript(@"window.geary.getText();")) ==
|
||||
"para\n\n\n\n");
|
||||
} catch (Geary.JS.Error err) {
|
||||
print("Geary.JS.Error: %s\n", err.message);
|
||||
|
|
@ -187,7 +187,7 @@ unknown://example6.com
|
|||
unichar q_marker = Geary.RFC822.Utils.QUOTE_MARKER;
|
||||
load_body_fixture("<p>pre</p> <blockquote><p>quote</p></blockquote> <p>post</p>");
|
||||
try {
|
||||
assert(WebKitUtil.to_string(run_javascript(@"window.geary.getText();")) ==
|
||||
assert(Util.WebKit.to_string(run_javascript(@"window.geary.getText();")) ==
|
||||
@"pre\n\n$(q_marker)quote\n$(q_marker)\npost\n\n\n\n");
|
||||
} catch (Geary.JS.Error err) {
|
||||
print("Geary.JS.Error: %s", err.message);
|
||||
|
|
@ -202,7 +202,7 @@ unknown://example6.com
|
|||
unichar q_marker = Geary.RFC822.Utils.QUOTE_MARKER;
|
||||
load_body_fixture("<p>pre</p> <blockquote><p>quote1</p> <blockquote><p>quote2</p></blockquote></blockquote> <p>post</p>");
|
||||
try {
|
||||
assert(WebKitUtil.to_string(run_javascript(@"window.geary.getText();")) ==
|
||||
assert(Util.WebKit.to_string(run_javascript(@"window.geary.getText();")) ==
|
||||
@"pre\n\n$(q_marker)quote1\n$(q_marker)\n$(q_marker)$(q_marker)quote2\n$(q_marker)$(q_marker)\npost\n\n\n\n");
|
||||
} catch (Geary.JS.Error err) {
|
||||
print("Geary.JS.Error: %s\n", err.message);
|
||||
|
|
@ -219,42 +219,42 @@ unknown://example6.com
|
|||
string suffix_keys = """new Set(["sf1", "sf2"])""";
|
||||
try {
|
||||
// Doesn't contain
|
||||
assert(!WebKitUtil.to_bool(run_javascript(
|
||||
assert(!Util.WebKit.to_bool(run_javascript(
|
||||
@"ComposerPageState.containsKeywords('notcontained', $complete_keys, $suffix_keys);"
|
||||
)));
|
||||
assert(!WebKitUtil.to_bool(run_javascript(
|
||||
assert(!Util.WebKit.to_bool(run_javascript(
|
||||
@"ComposerPageState.containsKeywords('not contained', $complete_keys, $suffix_keys);"
|
||||
)));
|
||||
assert(!WebKitUtil.to_bool(run_javascript(
|
||||
assert(!Util.WebKit.to_bool(run_javascript(
|
||||
@"ComposerPageState.containsKeywords('not\tcontained', $complete_keys, $suffix_keys);"
|
||||
)));
|
||||
assert(!WebKitUtil.to_bool(run_javascript(
|
||||
assert(!Util.WebKit.to_bool(run_javascript(
|
||||
@"ComposerPageState.containsKeywords('http://www.keyword1.com', $complete_keys, $suffix_keys);"
|
||||
)));
|
||||
assert(!WebKitUtil.to_bool(run_javascript(
|
||||
assert(!Util.WebKit.to_bool(run_javascript(
|
||||
@"ComposerPageState.containsKeywords('http://www.something.com/something.sf1', $complete_keys, $suffix_keys);"
|
||||
)));
|
||||
assert(!WebKitUtil.to_bool(run_javascript(
|
||||
assert(!Util.WebKit.to_bool(run_javascript(
|
||||
@"ComposerPageState.containsKeywords('sf1', $complete_keys, $suffix_keys);"
|
||||
)));
|
||||
assert(!WebKitUtil.to_bool(run_javascript(
|
||||
assert(!Util.WebKit.to_bool(run_javascript(
|
||||
@"ComposerPageState.containsKeywords('.sf1', $complete_keys, $suffix_keys);"
|
||||
)));
|
||||
|
||||
// Does contain
|
||||
assert(WebKitUtil.to_bool(run_javascript(
|
||||
assert(Util.WebKit.to_bool(run_javascript(
|
||||
@"ComposerPageState.containsKeywords('keyword1', $complete_keys, $suffix_keys);"
|
||||
)));
|
||||
assert(WebKitUtil.to_bool(run_javascript(
|
||||
assert(Util.WebKit.to_bool(run_javascript(
|
||||
@"ComposerPageState.containsKeywords('keyword2 contained', $complete_keys, $suffix_keys);"
|
||||
)));
|
||||
assert(WebKitUtil.to_bool(run_javascript(
|
||||
assert(Util.WebKit.to_bool(run_javascript(
|
||||
@"ComposerPageState.containsKeywords('keyword2\tcontained', $complete_keys, $suffix_keys);"
|
||||
)));
|
||||
assert(WebKitUtil.to_bool(run_javascript(
|
||||
assert(Util.WebKit.to_bool(run_javascript(
|
||||
@"ComposerPageState.containsKeywords('something.sf1', $complete_keys, $suffix_keys);"
|
||||
)));
|
||||
assert(WebKitUtil.to_bool(run_javascript(
|
||||
assert(Util.WebKit.to_bool(run_javascript(
|
||||
@"ComposerPageState.containsKeywords('something.something.sf2', $complete_keys, $suffix_keys);"
|
||||
)));
|
||||
} catch (Geary.JS.Error err) {
|
||||
|
|
@ -271,9 +271,9 @@ unknown://example6.com
|
|||
string single_nbsp = "a b";
|
||||
string multiple_nbsp = "a b c";
|
||||
try {
|
||||
assert(WebKitUtil.to_string(run_javascript(@"ComposerPageState.replaceNonBreakingSpace('$(single_nbsp)');")) ==
|
||||
assert(Util.WebKit.to_string(run_javascript(@"ComposerPageState.replaceNonBreakingSpace('$(single_nbsp)');")) ==
|
||||
"a b");
|
||||
assert(WebKitUtil.to_string(run_javascript(@"ComposerPageState.replaceNonBreakingSpace('$(multiple_nbsp)');")) ==
|
||||
assert(Util.WebKit.to_string(run_javascript(@"ComposerPageState.replaceNonBreakingSpace('$(multiple_nbsp)');")) ==
|
||||
"a b c");
|
||||
} catch (Geary.JS.Error err) {
|
||||
print("Geary.JS.Error: %s\n", err.message);
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ class ConversationPageStateTest : ClientWebViewTestCase<ConversationWebView> {
|
|||
public void is_descendant_of() throws GLib.Error {
|
||||
load_body_fixture("<blockquote><div id='test'>ohhai</div></blockquote>");
|
||||
assert(
|
||||
WebKitUtil.to_bool(
|
||||
Util.WebKit.to_bool(
|
||||
run_javascript("""
|
||||
ConversationPageState.isDescendantOf(
|
||||
document.getElementById('test'), "BLOCKQUOTE"
|
||||
|
|
@ -116,7 +116,7 @@ class ConversationPageStateTest : ClientWebViewTestCase<ConversationWebView> {
|
|||
public void is_descendant_of_with_class() throws GLib.Error {
|
||||
load_body_fixture("<blockquote class='test-class'><div id='test'>ohhai</div></blockquote>");
|
||||
assert(
|
||||
WebKitUtil.to_bool(
|
||||
Util.WebKit.to_bool(
|
||||
run_javascript("""
|
||||
ConversationPageState.isDescendantOf(
|
||||
document.getElementById('test'), "BLOCKQUOTE", "test-class"
|
||||
|
|
@ -129,7 +129,7 @@ class ConversationPageStateTest : ClientWebViewTestCase<ConversationWebView> {
|
|||
public void is_descendant_of_no_match() throws GLib.Error {
|
||||
load_body_fixture("<blockquote class='test-class'><div id='test'>ohhai</div></blockquote>");
|
||||
assert(
|
||||
WebKitUtil.to_bool(
|
||||
Util.WebKit.to_bool(
|
||||
run_javascript("""
|
||||
ConversationPageState.isDescendantOf(
|
||||
document.getElementById('test'), "DIV"
|
||||
|
|
@ -142,7 +142,7 @@ class ConversationPageStateTest : ClientWebViewTestCase<ConversationWebView> {
|
|||
public void is_descendant_of_lax() throws GLib.Error {
|
||||
load_body_fixture("<blockquote class='test-class'><div id='test'>ohhai</div></blockquote>");
|
||||
assert(
|
||||
WebKitUtil.to_bool(
|
||||
Util.WebKit.to_bool(
|
||||
run_javascript("""
|
||||
ConversationPageState.isDescendantOf(
|
||||
document.getElementById('test'), "DIV", null, false
|
||||
|
|
@ -159,7 +159,7 @@ class ConversationPageStateTest : ClientWebViewTestCase<ConversationWebView> {
|
|||
|
||||
private uint exec_is_deceptive_text(string text, string href) {
|
||||
try {
|
||||
return (uint) WebKitUtil.to_number(
|
||||
return (uint) Util.WebKit.to_number(
|
||||
run_javascript(@"ConversationPageState.isDeceptiveText(\"$text\", \"$href\")")
|
||||
);
|
||||
} catch (Geary.JS.Error err) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue