feat(ui): show username when auth is enabled

This commit is contained in:
Łukasz Mierzwa
2020-02-22 15:31:14 +00:00
parent fbff53c51b
commit b4a62f1079
2 changed files with 23 additions and 0 deletions

View File

@@ -81,6 +81,11 @@ const MainModalContent = observer(
) : null}
</div>
<div className="modal-footer">
{alertStore.info.authentication.enabled && (
<span className="text-muted mr-2">
Username: {alertStore.info.authentication.username}
</span>
)}
<span className="text-muted">
Version: {alertStore.info.version}
</span>

View File

@@ -96,4 +96,22 @@ describe("<MainModalContent />", () => {
it("calls setTab('help') after clicking on the 'Help' tab", () => {
ValidateSetTab("Help", "help");
});
it("shows username when alertStore.info.authentication.enabled=true", () => {
alertStore.info.authentication.enabled = true;
alertStore.info.authentication.username = "me@example.com";
const tree = mount(
<span>
{Wrapped(
<MainModalContent
alertStore={alertStore}
settingsStore={settingsStore}
onHide={onHide}
expandAllOptions={true}
/>
)}
</span>
);
expect(tree.text()).toMatch(/Username: me@example.com/);
});
});