@@ -87,6 +87,25 @@ function assertBlankPageVisible(container) {
8787 assertNotNull ( dom . getElementByClass ( 'firebaseui-id-page-blank' , container ) ) ;
8888}
8989
90+ /**
91+ * Asserts the IdP or tenant button has correct labels.
92+ * @param {!Element } button The IdP or tenant button.
93+ * @param {string } expectedShortLabel The expected short label of the button.
94+ * @param {string } expectedLongLabel The expected long label of the button.
95+ */
96+ function assertIdpButtonLabels ( button , expectedShortLabel , expectedLongLabel ) {
97+ const idpTextLong = dom . getElementsByClass (
98+ 'firebaseui-idp-text-long' , button ) ;
99+ const idpTextShort = dom . getElementsByClass (
100+ 'firebaseui-idp-text-short' , button ) ;
101+
102+ assertEquals (
103+ expectedLongLabel ,
104+ dom . getTextContent ( idpTextLong [ 0 ] ) ) ;
105+ assertEquals (
106+ expectedShortLabel ,
107+ dom . getTextContent ( idpTextShort [ 0 ] ) ) ;
108+ }
90109
91110/**
92111 * Asserts the busy indicator is after a short delay.
@@ -374,6 +393,7 @@ testSuite({
374393 'tenants' : {
375394 // The top-level project UI configuration.
376395 '_' : {
396+ 'fullLabel' : 'ACME Login' ,
377397 'displayName' : 'ACME' ,
378398 'buttonColor' : '#FFB6C1' ,
379399 'iconUrl' : '<icon-url-of-sign-in-button>' ,
@@ -393,6 +413,7 @@ testSuite({
393413 'privacyPolicyUrl' : 'http://localhost/privacy_policy' ,
394414 } ,
395415 'tenant1' : {
416+ 'fullLabel' : 'Contractor A Portal' ,
396417 'displayName' : 'Contractor A' ,
397418 'buttonColor' : '#ADF7B2' ,
398419 'iconUrl' : '<icon-url-of-sign-in-button>' ,
@@ -420,6 +441,7 @@ testSuite({
420441 'privacyPolicyUrl' : 'http://localhost/privacy_policy' ,
421442 } ,
422443 'tenant2' : {
444+ 'fullLabel' : 'Contractor B Portal' ,
423445 'displayName' : 'Contractor B' ,
424446 'buttonColor' : '#EAC9A1' ,
425447 'iconUrl' : '<icon-url-of-sign-in-button>' ,
@@ -490,10 +512,20 @@ testSuite({
490512 'firebaseui-id-tenant-selection-button' , container ) ;
491513 // Two tenants should be available to be selected from.
492514 const expectedTenants = [ 'tenant1' , 'tenant2' ] ;
515+ // Two expected labels on buttons.
516+ const expectedLongLabels = [
517+ 'Contractor A Portal' ,
518+ 'Sign in to Contractor B'
519+ ] ;
520+ const expectedShortLabels = [ 'Contractor A' , 'Contractor B' ] ;
521+
493522 assertEquals ( expectedTenants . length , buttons . length ) ;
494523 for ( let i = 0 ; i < buttons . length ; i ++ ) {
495- assertEquals ( expectedTenants [ i ] ,
496- dataset . get ( buttons [ i ] , 'tenantId' ) ) ;
524+ assertEquals ( expectedTenants [ i ] , dataset . get ( buttons [ i ] , 'tenantId' ) ) ;
525+ assertIdpButtonLabels (
526+ buttons [ i ] ,
527+ expectedShortLabels [ i ] ,
528+ expectedLongLabels [ i ] ) ;
497529 }
498530
499531 // Click the tenant1's button.
@@ -587,10 +619,19 @@ testSuite({
587619 'firebaseui-id-tenant-selection-button' , container ) ;
588620 // Only two tenants should be available to be selected from.
589621 const expectedTenants = [ 'tenant1' , 'tenant2' ] ;
622+ const expectedLongLabels = [
623+ 'Contractor A Portal' ,
624+ 'Sign in to Contractor B'
625+ ] ;
626+ const expectedShortLabels = [ 'Contractor A' , 'Contractor B' ] ;
590627 assertEquals ( expectedTenants . length , buttons . length ) ;
591628 for ( let i = 0 ; i < buttons . length ; i ++ ) {
592629 assertEquals ( expectedTenants [ i ] ,
593- dataset . get ( buttons [ i ] , 'tenantId' ) ) ;
630+ dataset . get ( buttons [ i ] , 'tenantId' ) ) ;
631+ assertIdpButtonLabels (
632+ buttons [ i ] ,
633+ expectedShortLabels [ i ] ,
634+ expectedLongLabels [ i ] ) ;
594635 }
595636
596637 testingEvents . fireClickSequence ( buttons [ 1 ] ) ;
0 commit comments