Skip to content

Commit 66d75ff

Browse files
committed
Switching from signed-in to -out to prevent breaking change
1 parent 3185119 commit 66d75ff

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
depends-on="mgt-teams-provider"
3030
></mgt-msal-provider>
3131

32-
<!-- <mgt-mock-provider signed-in></mgt-mock-provider> -->
32+
<mgt-mock-provider></mgt-mock-provider>
3333

3434
<mgt-login></mgt-login>
3535
<mgt-person person-query="me" show-name show-email person-card="hover"></mgt-person>

src/mock/mgt-mock-provider.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import { customElement, LitElement, property } from 'lit-element';
99
import { Providers } from '../Providers';
1010
import { MockProvider } from './MockProvider';
11+
import { MgtBaseProvider } from '../components/providers/baseProvider';
1112
/**
1213
* Sets global provider to a mock Provider
1314
*
@@ -16,26 +17,26 @@ import { MockProvider } from './MockProvider';
1617
* @extends {LitElement}
1718
*/
1819
@customElement('mgt-mock-provider')
19-
export class MgtMockProvider extends LitElement {
20+
export class MgtMockProvider extends MgtBaseProvider {
2021
/**
2122
* A property to allow the developer to start the sample logged out if they desired.
2223
*
2324
* @memberof MgtMockProvider
2425
*/
2526
@property({
26-
attribute: 'signed-in',
27+
attribute: 'signed-out',
2728
type: Boolean
2829
})
29-
public signedIn;
30+
public signedOut;
3031

31-
constructor() {
32-
super();
33-
34-
// Access the 'signed-in' attribute directly.
35-
// LitElement doesn't parse attributes early enough for us enact on them from the constructor.
36-
const signedInVal = (<any>this).getAttribute('signed-in');
37-
this.signedIn = signedInVal !== 'false' && signedInVal !== null;
38-
39-
Providers.globalProvider = new MockProvider(this.signedIn);
32+
/**
33+
* method called to initialize the provider. Each derived class should provide
34+
* their own implementation
35+
*
36+
* @protected
37+
* @memberof MgtBaseProvider
38+
*/
39+
protected initializeProvider() {
40+
Providers.globalProvider = new MockProvider(!this.signedOut);
4041
}
4142
}

0 commit comments

Comments
 (0)