-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from nongrata081/develop
Develop
- Loading branch information
Showing
16 changed files
with
160 additions
and
27 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Feature: Form feature | ||
In order to test form functionality | ||
As a user | ||
I want to test whether form is submittable when provided valid input | ||
|
||
Scenario: Make form submittable | ||
Given a valid input of multiple input component | ||
Then remove attribute disabled from submit button |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { validatorsFactory } from '../../../../utils/input-validators'; | ||
|
||
let validator = validatorsFactory('form'); | ||
|
||
let multipleInputValueMock = { | ||
postCode: { value: "1231as", valid: true }, | ||
licensePlate: { value: "1231as", valid: true }, | ||
moneyAmount: { value: "123.00", valid: true } | ||
}; | ||
|
||
|
||
describe('form input validator', function () { | ||
it('should return true when given object with valid input values', function () { | ||
expect(validator.validate(multipleInputValueMock)).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/components/license-plate-input/test/e2e/license-plate.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Feature: License plate input feature | ||
In order to test license plate input functionality | ||
As a user | ||
I want to test whether proper styles are applied for a valid input value | ||
|
||
Scenario: Apply proper styles to license plate input | ||
Given a valid license plate value | ||
Then class .valid is attached to license plate input container |
19 changes: 19 additions & 0 deletions
19
src/components/license-plate-input/test/unit/license-plate-input.unit.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { validatorsFactory } from '../../../../utils/input-validators'; | ||
|
||
let validator = validatorsFactory('license-plate'); | ||
|
||
|
||
describe('license-plate validator', function() { | ||
it('should return true when given license plate of dutch format', function() { | ||
expect(validator.validate('XX9999')).toBe(true); | ||
expect(validator.validate('99XX99')).toBe(true); | ||
expect(validator.validate('XX99XX')).toBe(true); | ||
expect(validator.validate('XXXX99')).toBe(true); | ||
expect(validator.validate('99XXXX')).toBe(true); | ||
expect(validator.validate('99XXX9')).toBe(true); | ||
expect(validator.validate('9XXX99')).toBe(true); | ||
expect(validator.validate('XX999X')).toBe(true); | ||
expect(validator.validate('X999XX')).toBe(true); | ||
expect(validator.validate('XXX99X')).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Feature: Money input feature | ||
In order to test money input functionality | ||
As a user | ||
I want to test whether proper styles are applied for a valid input value | ||
|
||
Scenario: Apply proper styles to money input | ||
Given a valid money amount value | ||
Then class .valid is attached to money input container |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { validatorsFactory } from '../../../../utils/input-validators'; | ||
|
||
let validator = validatorsFactory('money-input'); | ||
|
||
|
||
describe('money-input validator', function() { | ||
it('should return false when given amount of money >= 1000', function() { | ||
expect(validator.validate('1000')).toBe(false); | ||
}); | ||
|
||
it('should return true when given amount of money < 1000', function() { | ||
expect(validator.validate('999')).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/components/postcode-input/test/e2e/postcode-input.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Feature: Postcode input feature | ||
In order to test postcode input functionality | ||
As a user | ||
I want to test whether proper styles are applied for a valid input value | ||
|
||
Scenario: Apply proper styles to postcode input | ||
Given a valid postcode value | ||
Then class .valid is attached to postcode input container |
14 changes: 14 additions & 0 deletions
14
src/components/postcode-input/test/unit/postcode-input.unit.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { validatorsFactory } from '../../../../utils/input-validators'; | ||
|
||
let validator = validatorsFactory('postcode'); | ||
|
||
|
||
describe('postcode validator', function() { | ||
it('should return true when given postcode of format 1234ab', function() { | ||
expect(validator.validate('1234ab')).toBe(true); | ||
}); | ||
|
||
it('should return false when given postcode of format ab4231', function() { | ||
expect(validator.validate('ab4231')).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,52 @@ | ||
|
||
const { expect } = require('chai'); | ||
const { Given, Then, When, setWorldConstructor } = require('cucumber'); | ||
const { Given, Then } = require('cucumber'); | ||
|
||
Given('a running stencil app', function() { | ||
return browser.url(`/`); | ||
Given('a valid postcode value', function() { | ||
$('.postcode-input').waitForVisible(); | ||
$('.postcode-input').setValue('1234ab'); | ||
return; | ||
}); | ||
|
||
Then('I see the {string} header', function(title) { | ||
return expect($('h1').getText()).to.equal(title); | ||
}); | ||
Then('class .valid is attached to postcode input container', function() { | ||
return expect($('.postcode-input-container').getAttribute('class')).includes('valid'); | ||
}); | ||
|
||
|
||
Given('a valid money amount value', function() { | ||
$('.money-input').waitForVisible(); | ||
$('.money-input').setValue('123'); | ||
$('body').click(); | ||
return; | ||
}); | ||
|
||
Then('class .valid is attached to money input container', function() { | ||
return expect($('.money-input-container').getAttribute('class')).includes('valid'); | ||
}); | ||
|
||
Given('a valid license plate value', function() { | ||
$('#license-input').waitForVisible(); | ||
$('#license-input').setValue('XX99XX'); | ||
return; | ||
}); | ||
|
||
Then('class .valid is attached to license plate input container', function() { | ||
return expect($('.license-plate-input-container').getAttribute('class')).includes('valid'); | ||
}); | ||
|
||
Given('a valid input of multiple input component', function() { | ||
|
||
$('.postcode-input').waitForVisible(); | ||
$('#license-input').waitForVisible(); | ||
$('.money-input').waitForVisible(); | ||
|
||
$('.postcode-input').setValue('1234ab'); | ||
$('#license-input').setValue('XX99XX'); | ||
$('.money-input').setValue('123'); | ||
$('body').click(); | ||
return; | ||
}); | ||
|
||
Then('remove attribute disabled from submit button', function() { | ||
return expect($('.form-submit').getAttribute('disabled')).equal(null); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters