@@ -31,6 +31,7 @@ function ValidateDashboardConfigurationWorksAsExpected(pageView: string, excepti
3131 const dashboardEmbedConfig = {
3232 type : "dashboard" ,
3333 id : "fakeReportId" ,
34+ groupId : "fakeGroupId" ,
3435 accessToken : "fakeAccessToken" ,
3536 embedUrl : "fakeEmbedUrl" ,
3637 pageView : pageView
@@ -179,14 +180,16 @@ describe('service', function () {
179180 type : "report" ,
180181 id : "fakeReportId" ,
181182 accessToken : "fakeAccessToken" ,
182- embedUrl : "fakeEmbedUrl"
183+ embedUrl : "fakeEmbedUrl" ,
184+ groupId : "fakeGroupId" ,
183185 } ;
184186
185187 const dashboardEmbedConfig : embed . IEmbedConfiguration = {
186188 type : "dashboard" ,
187189 id : "fakeDashboardId" ,
188190 accessToken : "fakeAccessToken" ,
189- embedUrl : "fakeEmbedUrl"
191+ embedUrl : "fakeEmbedUrl" ,
192+ groupId : "fakeGroupId"
190193 } ;
191194
192195 powerbi . embed ( component [ 0 ] , reportEmbedConfig ) ;
@@ -209,13 +212,15 @@ describe('service', function () {
209212 accessToken : "fakeAccessToken" ,
210213 embedUrl : 'fakeUrl' ,
211214 id : 'report2' ,
212- type : 'report'
215+ type : 'report' ,
216+ groupId : "fakeGroupId"
213217 } ;
214218
215219 const createConfig : embed . IEmbedConfiguration = {
216220 datasetId : "fakeDashboardId" ,
217221 accessToken : "fakeAccessToken" ,
218- embedUrl : "fakeEmbedUrl"
222+ embedUrl : "fakeEmbedUrl" ,
223+ groupId : "fakeGroupId"
219224 } ;
220225
221226 // Act
@@ -245,7 +250,8 @@ describe('service', function () {
245250 language : 'languageName' ,
246251 formatLocale : 'formatName'
247252 }
248- }
253+ } ,
254+ groupId : "fakeGroupId"
249255 } ;
250256
251257 powerbi . embed ( $reportContainer [ 0 ] , testConfiguration ) ;
@@ -366,6 +372,52 @@ describe('service', function () {
366372 expect ( report . config . uniqueId ) . toEqual ( jasmine . any ( String ) ) ;
367373 } ) ;
368374
375+ it ( 'should get group id from configuration first' , function ( ) {
376+ // Arrange
377+ const testGroupId = "ABC123" ;
378+ const embedUrl = `https://embedded.powerbi.com/appTokenReportEmbed?groupId=DIFFERENTID` ;
379+ const $reportContainer = $ ( `<div powerbi-embed-url="${ embedUrl } " powerbi-type="report"></div>` )
380+ . appendTo ( '#powerbi-fixture' ) ;
381+
382+ const configuration : embed . IEmbedConfiguration = { id : 'fakeId' , groupId : testGroupId } ;
383+
384+ // Act
385+ const report = powerbi . embed ( $reportContainer [ 0 ] , configuration ) ;
386+
387+ // Assert
388+ expect ( ( < embed . IEmbedConfiguration > report . config ) . groupId ) . toEqual ( testGroupId ) ;
389+ } ) ;
390+
391+ it ( 'should get groupId from embeddUrl is not specified in config' , function ( ) {
392+ // Arrange
393+ const embedUrl = `https://embedded.powerbi.com/appTokenReportEmbed?groupId=DIFFERENTID` ;
394+ const $reportContainer = $ ( `<div powerbi-embed-url="${ embedUrl } " powerbi-type="report"></div>` )
395+ . appendTo ( '#powerbi-fixture' ) ;
396+
397+ const configuration : embed . IEmbedConfiguration = { id : 'fakeId' } ;
398+
399+ // Act
400+ const report = powerbi . embed ( $reportContainer [ 0 ] , configuration ) ;
401+
402+ // Assert
403+ expect ( ( < embed . IEmbedConfiguration > report . config ) . groupId ) . toEqual ( 'DIFFERENTID' ) ;
404+ } ) ;
405+
406+ it ( 'should get groupId undefined if not specified in embeddUrl or config' , function ( ) {
407+ // Arrange
408+ const embedUrl = `https://embedded.powerbi.com/appTokenReportEmbed?reportId=fakeId` ;
409+ const $reportContainer = $ ( `<div powerbi-embed-url="${ embedUrl } " powerbi-type="report"></div>` )
410+ . appendTo ( '#powerbi-fixture' ) ;
411+
412+ const configuration : embed . IEmbedConfiguration = { id : 'fakeId' } ;
413+
414+ // Act
415+ const report = powerbi . embed ( $reportContainer [ 0 ] , configuration ) ;
416+
417+ // Assert
418+ expect ( ( < embed . IEmbedConfiguration > report . config ) . groupId ) . toBeUndefined ( ) ;
419+ } ) ;
420+
369421 it ( 'should get filterPaneEnabled setting from attribute from config and then attribute' , function ( ) {
370422 // Arrange
371423 const testUniqueId = 'fakeUniqueId' ;
0 commit comments