Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve playground with options #26

Merged
merged 9 commits into from
Aug 12, 2020
Merged

Improve playground with options #26

merged 9 commits into from
Aug 12, 2020

Conversation

lbalmaceda
Copy link
Contributor

@lbalmaceda lbalmaceda commented Aug 4, 2020

Description

  • Adds forms to change the options on the go.
  • Adds the ability to obtain the access token, and displays it.

Testing

I've added unit tests for the components and some properties. There are some tests that are marked as ignored with xit until I find out how to modify the form on the template before calling the associated action.

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not master

Screenshots

Authenticated

image

NOT Authenticated

image

@lbalmaceda
Copy link
Contributor Author

A few things to talk @stevehobbsdev are around the package.json file for the playground. I'm using reactive forms and there's a special package I need to require as dependency for that, which shouldn't be part of the SDK contents. I think it would be best to create a new package.json file on the playground directory for dealing with that.

@@ -34,6 +34,7 @@
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.12.53",
"@angular/forms": "^10.0.5",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only used on the playground

@@ -1,54 +1,83 @@
<!-- Next Steps -->
<h1>{{ title | uppercase }}</h1>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to have a property for this


beforeEach(async(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no async code runs inside this

});

xit('should logout with default options', () => {
//TODO: uncheck all checkboxes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand to set up this test case we should be unchecking the option checkboxes


const butLogout = compiled.querySelector('#logout');
expect(butLogout.disabled).toBeFalse();
//TODO: assert logout() was called without options
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here, check that the SDK's logout method was called

isAuthenticated$ = this.auth.isAuthenticated$;
isLoading$ = this.auth.isLoading$;
user$ = this.auth.user$;
accessToken$ = new BehaviorSubject(null);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to keep the "manually" retrieved access token,

this.auth.getAccessTokenWithPopup(),
this.auth.getAccessTokenSilently()
)
.pipe(first())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runs once and unsubscribes

projects/playground/src/app/app.component.ts Outdated Show resolved Hide resolved
imports: [
BrowserModule,
AppRoutingModule,
ReactiveFormsModule,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one was added

Copy link
Contributor

@stevehobbsdev stevehobbsdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good, and I agree with defaulting returnTo on logout. If you feel like making that change, feel free to merge.

@lbalmaceda
Copy link
Contributor Author

@stevehobbsdev fixed the remaining unit tests, added the checkbox we talked about, and re-enabled the lint test command for this playground. If you're happy with the changes, good to merge

@lbalmaceda lbalmaceda merged commit 1c51294 into master Aug 12, 2020
@lbalmaceda lbalmaceda deleted the improve-playground branch August 12, 2020 16:01
@lbalmaceda lbalmaceda added the CH: Added PR is adding feature or functionality label Aug 14, 2020
@lbalmaceda lbalmaceda added this to the v0.2.0 milestone Aug 14, 2020
@stevehobbsdev stevehobbsdev mentioned this pull request Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CH: Added PR is adding feature or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants