aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src/app/user/user-logout
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-04-11 20:02:33 +0800
committerGitHub <noreply@github.com>2019-04-11 20:02:33 +0800
commit5b5ca3acb1b9decb5ad13798dc79ba2d58f2ce95 (patch)
tree695f7fc0bd2f6d940f64739a1f1f500c36806cef /Timeline/ClientApp/src/app/user/user-logout
parent1c9edc5914869a3bbde20742c483182636ee4d43 (diff)
parentc28941c6d86f8ea33521bba49d811bf3ff60b3d1 (diff)
downloadtimeline-5b5ca3acb1b9decb5ad13798dc79ba2d58f2ce95.tar.gz
timeline-5b5ca3acb1b9decb5ad13798dc79ba2d58f2ce95.tar.bz2
timeline-5b5ca3acb1b9decb5ad13798dc79ba2d58f2ce95.zip
Merge pull request #17 from crupest/15-user
Remember me and log out feature.
Diffstat (limited to 'Timeline/ClientApp/src/app/user/user-logout')
-rw-r--r--Timeline/ClientApp/src/app/user/user-logout/user-logout.component.css0
-rw-r--r--Timeline/ClientApp/src/app/user/user-logout/user-logout.component.html1
-rw-r--r--Timeline/ClientApp/src/app/user/user-logout/user-logout.component.spec.ts35
-rw-r--r--Timeline/ClientApp/src/app/user/user-logout/user-logout.component.ts16
4 files changed, 52 insertions, 0 deletions
diff --git a/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.css b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.css
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.css
diff --git a/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.html b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.html
new file mode 100644
index 00000000..309e5c83
--- /dev/null
+++ b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.html
@@ -0,0 +1 @@
+<p class="mat-body">Logout successfully!</p>
diff --git a/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.spec.ts b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.spec.ts
new file mode 100644
index 00000000..855ea4a1
--- /dev/null
+++ b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.spec.ts
@@ -0,0 +1,35 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { UserLogoutComponent } from './user-logout.component';
+import { InternalUserService } from '../internal-user-service/internal-user.service';
+
+describe('UserLogoutComponent', () => {
+ let component: UserLogoutComponent;
+ let fixture: ComponentFixture<UserLogoutComponent>;
+
+ let mockInternalUserService: jasmine.SpyObj<InternalUserService>;
+
+ beforeEach(async(() => {
+ mockInternalUserService = jasmine.createSpyObj('InternalUserService', ['logout']);
+
+ TestBed.configureTestingModule({
+ declarations: [UserLogoutComponent],
+ providers: [{ provide: InternalUserService, useValue: mockInternalUserService }]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(UserLogoutComponent);
+ component = fixture.componentInstance;
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+ it('should logout on init', () => {
+ fixture.detectChanges();
+ expect(mockInternalUserService.logout).toHaveBeenCalled();
+ });
+});
diff --git a/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.ts b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.ts
new file mode 100644
index 00000000..e004196f
--- /dev/null
+++ b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.ts
@@ -0,0 +1,16 @@
+import { Component, OnInit } from '@angular/core';
+
+import { InternalUserService } from '../internal-user-service/internal-user.service';
+
+@Component({
+ selector: 'app-user-logout',
+ templateUrl: './user-logout.component.html',
+ styleUrls: ['./user-logout.component.css']
+})
+export class UserLogoutComponent implements OnInit {
+ constructor(private userService: InternalUserService) { }
+
+ ngOnInit() {
+ this.userService.logout();
+ }
+}