Bug 1270149 - Don't clobber options when using a template. r=mkmelin a=rkent (test)
authorJorg K
Mon, 16 May 2016 20:13:35 -0700
changeset 27024 f707a3dcecc8e362ed0933f87471c1fb1e81bc4f
parent 27023 3399f3fdf71dfc210f028416d7fec860b0a5ad04
child 27025 0669065eeff487d5b8dd1dd9d734bf37aef1704d
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin, rkent
bugs1270149
Bug 1270149 - Don't clobber options when using a template. r=mkmelin a=rkent (test)
mail/test/mozmill/composition/test-drafts.js
--- a/mail/test/mozmill/composition/test-drafts.js
+++ b/mail/test/mozmill/composition/test-drafts.js
@@ -93,17 +93,17 @@ function test_open_draft_again() {
 
   press_delete(mc); // clean up after ourselves
 }
 
 /**
  * Bug 1202165
  * Test that the user set delivery format is preserved in a draft message.
  */
-function test_save_delivery_format() {
+function internal_check_delivery_format(editDraft) {
   let cwc = open_compose_new_mail();
 
   setupComposeWin(cwc, "test@example.invalid",
                   "Testing storing of the composition properties in the draft!",
                   "Hello!");
 
   // Select our wanted format.
   if (!mc.mozmillModule.isMac) {
@@ -152,27 +152,41 @@ function test_save_delivery_format() {
 
   be_in_folder(draftsFolder);
   select_click_row(0);
 
   // Wait for the notification with the Edit button.
   wait_for_notification_to_show(mc, kBoxId, "draftMsgContent");
 
   plan_for_new_window("msgcompose");
-  mc.click(mc.eid(kBoxId, {tagName: "button", label: "Edit"}));
+  if (editDraft) {
+    // Trigger "edit draft".
+    mc.click(mc.eid(kBoxId, {tagName: "button", label: "Edit"}));
+  } else {
+    // Trigger "edit as new" resulting in template processing.
+    mc.keypress(null, "e", {shiftKey: false, accelKey: true});
+  }
   cwc = wait_for_compose_window();
 
   // Check if format value was restored.
   assert_format_value("format_both", Ci.nsIMsgCompSendFormat.Both);
 
   close_compose_window(cwc);
 
   press_delete(mc); // clean up the created draft
 }
 
+function test_save_delivery_format_with_edit_draft() {
+  internal_check_delivery_format(true);
+}
+
+function test_save_delivery_format_with_edit_template() {
+  internal_check_delivery_format(false);
+}
+
 /**
  * Tests that 'Edit as New' leaves the original message in drafts folder.
  */
 function test_edit_as_new_in_draft() {
   make_new_sets_in_folder(draftsFolder, [{count: 1}]);
   be_in_folder(draftsFolder);
 
   assert_equals(draftsFolder.getTotalMessages(false), 1);