Bug 1066509 - Tests for the tab view in the desktop client panel. r=mikedeboer
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Wed, 17 Sep 2014 16:42:16 +0100
changeset 218065 7b5a1459ee19b9e5f13dd6c8680096c693b9c784
parent 218064 076a776862b486f257bebce524fc95aedb4a5b2a
child 218066 7638339c5defac9514e2e3ac569142bffd3aa58e
push id7029
push userrjesup@wgate.com
push dateSun, 05 Oct 2014 07:07:51 +0000
treeherdermozilla-aurora@701fcc5fcce9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer
bugs1066509
milestone34.0a2
Bug 1066509 - Tests for the tab view in the desktop client panel. r=mikedeboer
browser/components/loop/test/desktop-local/panel_test.js
--- a/browser/components/loop/test/desktop-local/panel_test.js
+++ b/browser/components/loop/test/desktop-local/panel_test.js
@@ -135,17 +135,17 @@ describe("loop.panel", function() {
         TestUtils.Simulate.click(availableMenuOption);
 
         expect(view.state.showMenu).eql(true);
       });
     });
   });
 
   describe("loop.panel.PanelView", function() {
-    var fakeClient, callUrlData, view;
+    var fakeClient, callUrlData, view, callTab, contactsTab;
 
     beforeEach(function() {
       callUrlData = {
         callUrl: "http://call.invalid/",
         expiresAt: 1000
       };
 
       fakeClient = {
@@ -153,16 +153,37 @@ describe("loop.panel", function() {
           cb(null, callUrlData);
         }
       };
 
       view = TestUtils.renderIntoDocument(loop.panel.PanelView({
         notifications: notifications,
         client: fakeClient
       }));
+
+      [callTab, contactsTab] =
+        TestUtils.scryRenderedDOMComponentsWithClass(view, "tab");
+    });
+
+    describe('TabView', function() {
+      it("should select contacts tab when clicking tab button", function() {
+        TestUtils.Simulate.click(
+          view.getDOMNode().querySelector('li[data-tab-name="contacts"]'));
+
+        expect(contactsTab.getDOMNode().classList.contains("selected"))
+          .to.be.true;
+      });
+
+      it("should select call tab when clicking tab button", function() {
+        TestUtils.Simulate.click(
+          view.getDOMNode().querySelector('li[data-tab-name="call"]'));
+
+        expect(callTab.getDOMNode().classList.contains("selected"))
+          .to.be.true;
+      });
     });
 
     describe("AuthLink", function() {
       it("should trigger the FxA sign in/up process when clicking the link",
         function() {
           navigator.mozLoop.loggedInToFxA = false;
           navigator.mozLoop.logInToFxA = sandbox.stub();