Bug 1526826 - Make BaseTextMixin extend BaseControlMixin r=surkov
authorBrian Grinstead <bgrinstead@mozilla.com>
Mon, 11 Feb 2019 17:33:07 +0000
changeset 458521 c589a17c80d57872806d2e2119897de969137e76
parent 458520 a1905418c2732b56321c85e050e5ae0b0f492595
child 458522 1ab1ab7f3bd619763ec905ad3b61d8eba7339593
push id35536
push userbtara@mozilla.com
push dateMon, 11 Feb 2019 21:54:04 +0000
treeherdermozilla-central@6d8e6f960446 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1526826
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1526826 - Make BaseTextMixin extend BaseControlMixin r=surkov Differential Revision: https://phabricator.services.mozilla.com/D19316
toolkit/content/customElements.js
toolkit/content/tests/chrome/test_custom_element_base.xul
--- a/toolkit/content/customElements.js
+++ b/toolkit/content/customElements.js
@@ -308,17 +308,17 @@ const BaseControlMixin = Base => {
   }
 
   Base.implementCustomInterface(BaseControl,
                                 [Ci.nsIDOMXULControlElement]);
   return BaseControl;
 };
 MozElements.BaseControl = BaseControlMixin(MozXULElement);
 
-const BaseTextMixin = Base => class extends Base {
+const BaseTextMixin = Base => class extends BaseControlMixin(Base) {
   set label(val) {
     this.setAttribute("label", val);
     return val;
   }
 
   get label() {
     return this.getAttribute("label");
   }
--- a/toolkit/content/tests/chrome/test_custom_element_base.xul
+++ b/toolkit/content/tests/chrome/test_custom_element_base.xul
@@ -24,16 +24,17 @@
 
   SimpleTest.waitForExplicitFinish();
 
   async function runTests() {
     ok(MozXULElement, "MozXULElement defined on the window");
     testMixin();
     testBaseControl();
     testBaseControlMixin();
+    testBaseText();
     testParseXULToFragment();
     testInherits();
     await testCustomInterface();
 
     let htmlWin = await new Promise(resolve => {
       let htmlIframe = document.createElement("iframe");
       htmlIframe.src = "file_empty.xhtml";
       htmlIframe.onload = () => resolve(htmlIframe.contentWindow);
@@ -58,16 +59,24 @@
 
   function testBaseControlMixin() {
     ok(BaseControlMixin, "Mixin exists");
     let MixedHTMLSpanElement = MozElementMixin(HTMLSpanElement);
     let HTMLSpanBaseControl = BaseControlMixin(MixedHTMLSpanElement);
     ok("disabled" in HTMLSpanBaseControl.prototype, "Mixed in class prototype contains base control attributes");
   }
 
+  function testBaseText() {
+    ok(MozElements.BaseText, "BaseText exists");
+    ok("label" in MozElements.BaseText.prototype,
+      "BaseText prototype inherits BaseText attributes");
+    ok("disabled" in MozElements.BaseText.prototype,
+      "BaseText prototype inherits BaseControl attributes");
+  }
+
   function testParseXULToFragment() {
     ok(MozXULElement.parseXULToFragment, "parseXULToFragment helper exists");
 
     let frag = MozXULElement.parseXULToFragment(`<deck id='foo' />`);
     ok(frag instanceof DocumentFragment);
 
     document.documentElement.appendChild(frag);