-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: typing for LocalizationHelper.strings (#2998)
adds extended tests for Localization on mgt-person removes the initials property from the default set of strings for mgt-person
- Loading branch information
1 parent
c8c564d
commit 0317fc2
Showing
4 changed files
with
69 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* ------------------------------------------------------------------------------------------- | ||
*/ | ||
import { fixture, html, expect, oneEvent } from '@open-wc/testing'; | ||
import { MockProvider, Providers } from '@microsoft/mgt-element'; | ||
import { LocalizationHelper, MockProvider, Providers } from '@microsoft/mgt-element'; | ||
import { registerMgtPersonComponent } from './mgt-person'; | ||
|
||
describe('mgt-person - tests', () => { | ||
|
@@ -171,3 +171,66 @@ describe('mgt-person - tests', () => { | |
await expect(person.shadowRoot.querySelector('span.initials')).lightDom.to.equal('FV'); | ||
}); | ||
}); | ||
|
||
describe('mgt-person - localization', () => { | ||
registerMgtPersonComponent(); | ||
Providers.globalProvider = new MockProvider(true); | ||
|
||
afterEach(() => { | ||
LocalizationHelper.strings = { | ||
_components: {} | ||
}; | ||
}); | ||
it('should render with updated photo for text', async () => { | ||
LocalizationHelper.strings = { | ||
_components: { | ||
person: { | ||
photoFor: 'test value' | ||
} | ||
} | ||
}; | ||
const person = await fixture(html`<mgt-person person-query="me" view="twolines"></mgt-person>`); | ||
await oneEvent(person, 'person-image-rendered'); | ||
await expect(person).shadowDom.to.equal( | ||
`<div class=" person-root twolines " dir="ltr"> | ||
<div class="avatar-wrapper"> | ||
<img alt="test value Megan Bowen" src=""> | ||
</div> | ||
<div class=" details-wrapper "> | ||
<div class="line1" role="presentation" aria-label="Megan Bowen">Megan Bowen</div> | ||
<div class="line2" role="presentation" aria-label="Auditor">Auditor</div> | ||
</div> | ||
</div>`, | ||
{ ignoreAttributes: ['src'] } | ||
); | ||
}); | ||
it('should render with updated email address text', async () => { | ||
LocalizationHelper.strings = { | ||
_components: { | ||
person: { | ||
emailAddress: 'test value' | ||
} | ||
} | ||
}; | ||
const person = await fixture( | ||
html`<mgt-person person-details='${JSON.stringify({ | ||
mail: '[email protected]', | ||
personType: {} | ||
})}' view="image"></mgt-person>` | ||
); | ||
// await oneEvent(person, 'person-icon-rendered'); | ||
await expect(person).shadowDom.to.equal( | ||
`<div class="noline person-root small" dir="ltr"> | ||
<div class="avatar-wrapper"> | ||
<span | ||
class="contact-icon" | ||
title="test value [email protected]" | ||
> | ||
<i></i> | ||
</span> | ||
</div> | ||
</div>`, | ||
{ ignoreAttributes: ['src'] } | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters