+ Login with your corporate credentials. []
+
+ }
+ data-i18n={
+ {
+ "str": [Function],
+ }
+ }
+ data-model={
+ Immutable.Map {
+ "id": "__lock-id__",
+ "i18n": Immutable.Map {
+ "strings": Immutable.Map {
+ "enterpriseLoginIntructions": "Login with your corporate credentials.",
+ "enterpriseActiveLoginInstructions": "Please enter your corporate credentials at %s.",
+ },
+ },
+ }
+ }
+ data-passwordInputPlaceholder=" []"
+ data-usernameInputPlaceholder=" []"
+/>
+`;
+
exports[`HRDScreen Component renders correctly when there is an enterprise domain 1`] = `
`;
+
+exports[`HRDScreen Component uses fallback message when enterprise domain is empty string 1`] = `
+
+ Login with your corporate credentials. []
+
+ }
+ data-i18n={
+ {
+ "str": [Function],
+ }
+ }
+ data-model={
+ Immutable.Map {
+ "id": "__lock-id__",
+ "i18n": Immutable.Map {
+ "strings": Immutable.Map {
+ "enterpriseLoginIntructions": "Login with your corporate credentials.",
+ "enterpriseActiveLoginInstructions": "Please enter your corporate credentials at %s.",
+ },
+ },
+ }
+ }
+ data-passwordInputPlaceholder=" []"
+ data-usernameInputPlaceholder=" []"
+/>
+`;
+
+exports[`HRDScreen Component uses fallback message when enterprise domain is whitespace only 1`] = `
+
+ Login with your corporate credentials. []
+
+ }
+ data-i18n={
+ {
+ "str": [Function],
+ }
+ }
+ data-model={
+ Immutable.Map {
+ "id": "__lock-id__",
+ "i18n": Immutable.Map {
+ "strings": Immutable.Map {
+ "enterpriseLoginIntructions": "Login with your corporate credentials.",
+ "enterpriseActiveLoginInstructions": "Please enter your corporate credentials at %s.",
+ },
+ },
+ }
+ }
+ data-passwordInputPlaceholder=" []"
+ data-usernameInputPlaceholder=" []"
+/>
+`;
diff --git a/src/__tests__/connection/enterprise/hrd_screen.test.js b/src/__tests__/connection/enterprise/hrd_screen.test.js
index 00c1ea18f..592d1b295 100644
--- a/src/__tests__/connection/enterprise/hrd_screen.test.js
+++ b/src/__tests__/connection/enterprise/hrd_screen.test.js
@@ -49,4 +49,41 @@ describe('HRDScreen Component', () => {
const Component = getComponent();
expectComponent().toMatchSnapshot();
});
+
+ it('renders correctly when enterprise domain is undefined', () => {
+ require('connection/enterprise').enterpriseDomain.mockImplementation(() => undefined);
+ const Component = getComponent();
+ expectComponent().toMatchSnapshot();
+ });
+
+ it('does not show "undefined" in message when enterprise domain is undefined', () => {
+ require('connection/enterprise').enterpriseDomain.mockImplementation(() => undefined);
+ const { str } = i18nProp;
+
+ // Should use the fallback message without domain placeholder
+ const expectedMessage = str('enterpriseLoginIntructions');
+ expect(expectedMessage).toContain('Login with your corporate credentials.');
+ expect(expectedMessage).not.toContain('undefined');
+ });
+
+ it('does not show "undefined" in message when enterprise domain is null', () => {
+ require('connection/enterprise').enterpriseDomain.mockImplementation(() => null);
+ const { str } = i18nProp;
+ // Should use the fallback message without domain placeholder
+ const expectedMessage = str('enterpriseLoginIntructions');
+ expect(expectedMessage).toContain('Login with your corporate credentials.');
+ expect(expectedMessage).not.toContain('undefined');
+ });
+
+ it('uses fallback message when enterprise domain is empty string', () => {
+ require('connection/enterprise').enterpriseDomain.mockImplementation(() => '');
+ const Component = getComponent();
+ expectComponent().toMatchSnapshot();
+ });
+
+ it('uses fallback message when enterprise domain is whitespace only', () => {
+ require('connection/enterprise').enterpriseDomain.mockImplementation(() => ' ');
+ const Component = getComponent();
+ expectComponent().toMatchSnapshot();
+ });
});
diff --git a/src/connection/enterprise/hrd_screen.jsx b/src/connection/enterprise/hrd_screen.jsx
index 2eeb09b32..2a6df2ab2 100644
--- a/src/connection/enterprise/hrd_screen.jsx
+++ b/src/connection/enterprise/hrd_screen.jsx
@@ -11,7 +11,7 @@ const Component = ({ i18n, model }) => {
var headerText;
- if (domain !== null) {
+ if (domain && domain.trim()) {
headerText = i18n.str('enterpriseActiveLoginInstructions', domain);
} else {
headerText = i18n.str('enterpriseLoginIntructions');