Skip to content

Commit 4980eb6

Browse files
committed
demo(ngx-material-password-strength): updated index.html
1 parent 83574ca commit 4980eb6

File tree

4 files changed

+88
-36
lines changed

4 files changed

+88
-36
lines changed

demo/src/index.html

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,53 @@
77
ngx-material-password-strength
88
</title>
99
<base href=".">
10-
<meta name="description" content="Material password strength meter to indicate how secure is the provided password" />
10+
<meta name="description" content="Material password strength meter to indicate how secure is the provided password"/>
1111

1212
<!-- Twitter Card data -->
1313
<meta name="twitter:card" content="summary">
1414
<meta name="twitter:site" content="@anthonynahas">
1515
<meta name="twitter:title" content="ngx-material-password-strength">
1616
<!-- Page description less than 200 characters -->
17-
<meta name="twitter:description" content="Material password strength meter to indicate how secure is the provided password">
17+
<meta name="twitter:description"
18+
content="Material password strength meter to indicate how secure is the provided password">
1819
<meta name="twitter:creator" content="@anthonynahas">
1920
<!-- Twitter Summary card images must be at least 120x120px -->
2021
<meta name="twitter:image" content="https://anthonynahas.github.io/ngx-material-password-strength/assets/logo.svg">
2122

2223
<!-- Open Graph data -->
23-
<meta property="og:title" content="ngx-material-password-strength" />
24-
<meta property="og:type" content="article" />
25-
<meta property="og:url" content="https://anthonynahas.github.io/ngx-material-password-strength" />
26-
<meta property="og:image" content="https://anthonynahas.github.io/ngx-material-password-strength/assets/logo.svg" />
27-
<meta property="og:description" content="Material password strength meter to indicate how secure is the provided password" />
28-
<meta property="og:site_name" content="ngx-material-password-strength" />
24+
<meta property="og:title" content="ngx-material-password-strength"/>
25+
<meta property="og:type" content="article"/>
26+
<meta property="og:url" content="https://anthonynahas.github.io/ngx-material-password-strength"/>
27+
<meta property="og:image" content="https://anthonynahas.github.io/ngx-material-password-strength/assets/logo.svg"/>
28+
<meta property="og:description"
29+
content="Material password strength meter to indicate how secure is the provided password"/>
30+
<meta property="og:site_name" content="ngx-material-password-strength"/>
2931

3032
<meta charset="utf-8">
3133
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
3234
<meta http-equiv="x-ua-compatible" content="ie=edge">
3335
<link rel="icon" type="image/x-icon" href="favicon.ico">
3436
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
3537

38+
<!-- Global site tag (gtag.js) - Google Analytics -->
39+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-114342493-4"></script>
40+
<script>
41+
window.dataLayer = window.dataLayer || [];
42+
43+
function gtag() {
44+
dataLayer.push(arguments);
45+
}
46+
47+
gtag('js', new Date());
48+
49+
gtag('config', 'UA-114342493-4');
50+
</script>
51+
52+
3653
</head>
3754

3855
<body>
39-
<app-root>Loading...</app-root>
56+
<app-root>Loading...</app-root>
4057
</body>
4158

4259
</html>

package-lock.json

Lines changed: 25 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"karma-sourcemap-loader": "0.3.7",
8888
"karma-webpack": "3.0.0",
8989
"lodash": "4.17.5",
90+
"ngx-combination-generator": "^1.0.2",
9091
"node-sass": "4.8.3",
9192
"postcss": "6.0.21",
9293
"postcss-strip-inline-comments": "0.1.5",

src/module/component/password-strength/password-strength.component.spec.ts

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import {async, ComponentFixture, TestBed} from '@angular/core/testing';
33
import {Colors, PasswordStrengthComponent} from './password-strength.component';
44
import {MatProgressBarModule} from '@angular/material';
55
import {SimpleChange} from '@angular/core';
6+
import {NgxCombinationGeneratorService} from 'ngx-combination-generator';
67

78
describe('PasswordStrengthComponent', () => {
89
let component: PasswordStrengthComponent;
910
let fixture: ComponentFixture<PasswordStrengthComponent>;
11+
const generator = new NgxCombinationGeneratorService();
1012

1113
beforeEach(async(() => {
1214
TestBed.configureTestingModule({
@@ -69,16 +71,42 @@ describe('PasswordStrengthComponent', () => {
6971
});
7072
});
7173

72-
it('should strength = 40 and color = warn when the password fulfills 2 criteria ', () => {
73-
const combinations = ['Aa', 'aA', '1a', 'A!'];
74-
// const combinations = generator(chars, 2, 3);
75-
console.log('combinations = ', combinations);
76-
combinations.forEach(combination => {
77-
component.password = combination;
78-
console.log('combination = ', combination);
74+
it('should strength = 40 and color = accent when the password ave at least 8 chars with lower case letters',
75+
() => {
76+
component.password = 'abcdefgw';
7977
component.calculatePasswordStrength();
8078
expect(component.strength).toBe(40);
8179
expect(component.color).toBe(Colors.accent);
8280
});
83-
});
81+
82+
it('should strength = 40 and color = accent when the password fulfills 2 criteria ',
83+
() => {
84+
const charsList = ['a', 'A', '1', '!'];
85+
const combinations = generator.loadCombinationList(charsList, 2, 2, true);
86+
console.log('combinations = ', combinations);
87+
combinations.forEach(combination => {
88+
component.password = combination;
89+
console.log('combination = ', combination);
90+
component.calculatePasswordStrength();
91+
expect(component.strength).toBe(40);
92+
expect(component.color).toBe(Colors.accent);
93+
});
94+
});
95+
96+
it('should strength = 60 and color = accent when the password fulfills 3 criteria ',
97+
() => {
98+
const charsList = ['a', 'A', '1', '!', '1234567'];
99+
const combinations = generator.loadCombinationList(charsList, 3, 3, true);
100+
console.log('combinations = ', combinations);
101+
102+
combinations.forEach(combination => {
103+
console.log('combination = ', combination);
104+
const repeats = /(.)\1/;
105+
console.log('repeats = ', repeats.test(combination));
106+
component.password = combination;
107+
component.calculatePasswordStrength();
108+
// expect(component.strength).toBe(60);
109+
// expect(component.color).toBe(Colors.accent);
110+
});
111+
});
84112
});

0 commit comments

Comments
 (0)