@webex/plugin-meetings 3.0.0-beta.180 → 3.0.0-beta.181

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,6 +26,7 @@ import {
26
26
  LOCUSINFO,
27
27
  PC_BAIL_TIMEOUT,
28
28
  DISPLAY_HINTS,
29
+ SELF_POLICY,
29
30
  } from '@webex/plugin-meetings/src/constants';
30
31
  import * as InternalMediaCoreModule from '@webex/internal-media-core';
31
32
  import {
@@ -5664,10 +5665,99 @@ describe('plugin-meetings', () => {
5664
5665
  waitingForOthersToJoinSpy.restore();
5665
5666
  });
5666
5667
 
5668
+ forEach(
5669
+ [
5670
+ {
5671
+ actionName: 'canShareFile',
5672
+ requiredDisplayHints: [DISPLAY_HINTS.SHARE_FILE],
5673
+ requiredPolicies: [SELF_POLICY.SUPPORT_FILE_SHARE],
5674
+ },
5675
+ {
5676
+ actionName: 'canShareApplication',
5677
+ requiredDisplayHints: [DISPLAY_HINTS.SHARE_APPLICATION],
5678
+ requiredPolicies: [SELF_POLICY.SUPPORT_APP_SHARE],
5679
+ },
5680
+ {
5681
+ actionName: 'canShareCamera',
5682
+ requiredDisplayHints: [DISPLAY_HINTS.SHARE_CAMERA],
5683
+ requiredPolicies: [SELF_POLICY.SUPPORT_CAMERA_SHARE],
5684
+ },
5685
+ {
5686
+ actionName: 'canShareDesktop',
5687
+ requiredDisplayHints: [DISPLAY_HINTS.SHARE_DESKTOP],
5688
+ requiredPolicies: [SELF_POLICY.SUPPORT_DESKTOP_SHARE],
5689
+ },
5690
+ ],
5691
+ ({actionName, requiredDisplayHints, requiredPolicies}) => {
5692
+ it(`${actionName} is enabled when the conditions are met`, () => {
5693
+ meeting.selfUserPolicies = {};
5694
+
5695
+ forEach(requiredPolicies, (policy) => {
5696
+ meeting.selfUserPolicies[policy] = true;
5697
+ });
5698
+
5699
+ meeting.setUpLocusInfoMeetingInfoListener();
5700
+
5701
+ const callback = locusInfoOnSpy.thirdCall.args[1];
5702
+
5703
+ const payload = {
5704
+ info: {
5705
+ userDisplayHints: requiredDisplayHints,
5706
+ },
5707
+ };
5708
+
5709
+ callback(payload);
5710
+
5711
+ assert.isTrue(meeting.inMeetingActions.get()[actionName]);
5712
+ });
5713
+
5714
+ it(`${actionName} is disabled when the required display hints are missing`, () => {
5715
+ meeting.selfUserPolicies = {};
5716
+
5717
+ forEach(requiredPolicies, (policy) => {
5718
+ meeting.selfUserPolicies[policy] = true;
5719
+ });
5720
+
5721
+ meeting.setUpLocusInfoMeetingInfoListener();
5722
+
5723
+ const callback = locusInfoOnSpy.thirdCall.args[1];
5724
+
5725
+ const payload = {
5726
+ info: {
5727
+ userDisplayHints: [],
5728
+ },
5729
+ };
5730
+
5731
+ callback(payload);
5732
+
5733
+ assert.isFalse(meeting.inMeetingActions.get()[actionName]);
5734
+ });
5735
+
5736
+ it(`${actionName} is disabled when the required policies are missing`, () => {
5737
+ meeting.selfUserPolicies = {};
5738
+
5739
+ meeting.setUpLocusInfoMeetingInfoListener();
5740
+
5741
+ const callback = locusInfoOnSpy.thirdCall.args[1];
5742
+
5743
+ const payload = {
5744
+ info: {
5745
+ userDisplayHints: requiredDisplayHints,
5746
+ },
5747
+ };
5748
+
5749
+ callback(payload);
5750
+
5751
+ assert.isFalse(meeting.inMeetingActions.get()[actionName]);
5752
+ });
5753
+ }
5754
+ );
5755
+
5667
5756
  it('registers the correct MEETING_INFO_UPDATED event', () => {
5668
5757
  // Due to import tree issues, hasHints must be stubed within the scope of the `it`.
5669
5758
  const restorableHasHints = ControlsOptionsUtil.hasHints;
5670
5759
  ControlsOptionsUtil.hasHints = sinon.stub().returns(true);
5760
+ ControlsOptionsUtil.hasPolicies = sinon.stub().returns(true);
5671
5761
 
5672
5762
  const setUserPolicySpy = sinon.spy(meeting.recordingController, 'setUserPolicy');
5673
5763
  meeting.selfUserPolicies = {a: true};
@@ -5766,18 +5856,34 @@ describe('plugin-meetings', () => {
5766
5856
  requiredHints: [DISPLAY_HINTS.SHARE_FILE],
5767
5857
  displayHints: payload.info.userDisplayHints,
5768
5858
  });
5859
+ assert.calledWith(ControlsOptionsUtil.hasPolicies, {
5860
+ requiredPolicies: [SELF_POLICY.SUPPORT_FILE_SHARE],
5861
+ policies: {a: true},
5862
+ });
5769
5863
  assert.calledWith(ControlsOptionsUtil.hasHints, {
5770
5864
  requiredHints: [DISPLAY_HINTS.SHARE_APPLICATION],
5771
5865
  displayHints: payload.info.userDisplayHints,
5772
5866
  });
5867
+ assert.calledWith(ControlsOptionsUtil.hasPolicies, {
5868
+ requiredPolicies: [SELF_POLICY.SUPPORT_APP_SHARE],
5869
+ policies: {a: true},
5870
+ });
5773
5871
  assert.calledWith(ControlsOptionsUtil.hasHints, {
5774
5872
  requiredHints: [DISPLAY_HINTS.SHARE_CAMERA],
5775
5873
  displayHints: payload.info.userDisplayHints,
5776
5874
  });
5875
+ assert.calledWith(ControlsOptionsUtil.hasPolicies, {
5876
+ requiredPolicies: [SELF_POLICY.SUPPORT_CAMERA_SHARE],
5877
+ policies: {a: true},
5878
+ });
5777
5879
  assert.calledWith(ControlsOptionsUtil.hasHints, {
5778
5880
  requiredHints: [DISPLAY_HINTS.SHARE_DESKTOP],
5779
5881
  displayHints: payload.info.userDisplayHints,
5780
5882
  });
5883
+ assert.calledWith(ControlsOptionsUtil.hasPolicies, {
5884
+ requiredPolicies: [SELF_POLICY.SUPPORT_DESKTOP_SHARE],
5885
+ policies: {a: true},
5886
+ });
5781
5887
  assert.calledWith(ControlsOptionsUtil.hasHints, {
5782
5888
  requiredHints: [DISPLAY_HINTS.SHARE_CONTENT],
5783
5889
  displayHints: payload.info.userDisplayHints,