2017-04-25 16:41:03 -07:00
|
|
|
import {browser, by, element} from 'protractor';
|
2017-07-27 09:49:11 -07:00
|
|
|
|
2017-04-25 16:41:03 -07:00
|
|
|
describe('input', () => {
|
|
|
|
|
describe('text input', () => {
|
|
|
|
|
beforeEach(() => browser.get('/input'));
|
|
|
|
|
|
2017-11-14 03:55:53 +01:00
|
|
|
it('should update input value when user types', async () => {
|
2017-04-25 16:41:03 -07:00
|
|
|
let input = element(by.id('text-input'));
|
|
|
|
|
input.sendKeys('abc123');
|
2017-11-14 03:55:53 +01:00
|
|
|
expect(await input.getAttribute('value')).toBe('abc123');
|
2017-04-25 16:41:03 -07:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('number input', () => {
|
|
|
|
|
beforeEach(() => browser.get('/input'));
|
|
|
|
|
|
2017-11-14 03:55:53 +01:00
|
|
|
it('should update input value when user types', async () => {
|
2017-04-25 16:41:03 -07:00
|
|
|
let input = element(by.id('number-input'));
|
|
|
|
|
input.sendKeys('abc123');
|
2017-11-14 03:55:53 +01:00
|
|
|
expect(await input.getAttribute('value')).toBe('123');
|
2017-04-25 16:41:03 -07:00
|
|
|
});
|
|
|
|
|
|
2017-06-01 17:49:20 +02:00
|
|
|
it('should increment when increment button clicked', async () => {
|
|
|
|
|
const input = element(by.id('number-input'));
|
|
|
|
|
|
2017-04-25 16:41:03 -07:00
|
|
|
input.click();
|
|
|
|
|
|
2017-06-01 17:49:20 +02:00
|
|
|
const size = await input.getSize();
|
|
|
|
|
|
|
|
|
|
browser.actions()
|
|
|
|
|
.mouseMove(input, {x: size.width - 5, y: 5})
|
|
|
|
|
.click()
|
|
|
|
|
.perform();
|
|
|
|
|
|
2017-11-14 03:55:53 +01:00
|
|
|
expect(await input.getAttribute('value')).toBe('1');
|
2017-04-25 16:41:03 -07:00
|
|
|
|
2017-06-01 17:49:20 +02:00
|
|
|
browser.actions()
|
|
|
|
|
.mouseMove(input, {x: size.width - 5, y: size.height - 5})
|
|
|
|
|
.click()
|
|
|
|
|
.perform();
|
2017-04-25 16:41:03 -07:00
|
|
|
|
2017-11-14 03:55:53 +01:00
|
|
|
expect(await input.getAttribute('value')).toBe('0');
|
2017-04-25 16:41:03 -07:00
|
|
|
});
|
|
|
|
|
});
|
2017-07-07 00:53:21 +02:00
|
|
|
|
|
|
|
|
describe('textarea', () => {
|
|
|
|
|
beforeEach(() => browser.get('/input'));
|
|
|
|
|
|
2017-11-14 03:55:53 +01:00
|
|
|
it('should update input value when user types', async () => {
|
2017-07-07 00:53:21 +02:00
|
|
|
let input = element(by.id('text-area'));
|
|
|
|
|
input.sendKeys('abc123');
|
2017-11-14 03:55:53 +01:00
|
|
|
expect(await input.getAttribute('value')).toBe('abc123');
|
2017-07-07 00:53:21 +02:00
|
|
|
});
|
|
|
|
|
});
|
2017-07-20 10:57:50 -07:00
|
|
|
|
|
|
|
|
describe('autosize-textarea', () => {
|
|
|
|
|
beforeEach(() => browser.get('/input'));
|
|
|
|
|
|
|
|
|
|
it('should resize correctly', () => {
|
|
|
|
|
let input = element(by.id('autosize-text-area'));
|
|
|
|
|
input.sendKeys('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should enfore max rows', () => {
|
|
|
|
|
let input = element(by.id('autosize-text-area'));
|
|
|
|
|
input.sendKeys(
|
|
|
|
|
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
|
|
|
|
|
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
|
|
|
|
|
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
|
|
|
|
|
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
|
|
|
|
|
});
|
|
|
|
|
});
|
2017-04-25 16:41:03 -07:00
|
|
|
});
|