Skip to content

Commit

Permalink
2.3.0-alpha.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
JayCanuck committed Feb 12, 2019
2 parents f2f2a55 + 34038ac commit 482a111
Show file tree
Hide file tree
Showing 409 changed files with 12,436 additions and 9,520 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ cache:
- $(npm config get cache)
install:
- npm config set prefer-offline true
- npm install -g enactjs/cli#5382f263d24c112195166ae3e45edca8ae96b232
- npm install -g enactjs/cli#develop
- npm install
- npm run bootstrap
script:
- echo -e "\x1b\x5b35;1m*** Starting tests...\x1b\x5b0m"
- npm run lerna -- run test
- npm test -- -- -- --maxWorkers=4
- echo -e "\x1b\x5b35;1m*** Tests complete\x1b\x5b0m"
- echo -e "\x1b\x5b35;1m*** Starting eslint...\x1b\x5b0m"
- npm run lerna -- run lint -- -- -- --max-warnings 0 .
Expand Down
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,42 @@

The following is a curated list of changes in the Enact project, newest changes on the top.

## [2.3.0] - 2019-02-11

### Deprecated

- `core/kind` config property `contextTypes`, to be removed in 3.0.

### Added

- `core/kind` config property `contextType` replacing legacy `contextTypes` property
- `i18n/I18nDecorator` HOC config prop `resources` to support retrieval of user-space i18n resource files on locale change
- `i18n/I18nDecorator` HOC config prop `sync` to support asynchronous retrieval of i18n resource files
- `i18n/I18nDecorator` HOC config props `latinLanguageOverrides` and `nonLatinLanguageOverrides` to allow consumers to configure some locales to be treated as Latin or non-Latin for the purposes of applying the `enact-locale-non-latin` global class name.
- `i18n/Text` component to provide asynchronous text translations
- `moonstone/VirtualList.VirtualGridList` and `moonstone/VirtualList.VirtualList` property `childProps` to support additional props included in the object passed to the `itemsRenderer` callback
- `moonstone/Skinnable` support for `skinVariants`, to enable features like high contrast mode and large text mode
- Support for 8k (UHD2) displays
- `spotlight/Spottable` property `selectionKeys`
- `ui/Skinnable` support for `skinVariants`; a way to augment a skin by adding variations of a skin to your visuals, like large text, high contrast, or grayscale
- `ui/Touchable` event `onHoldEnd` to notify when a hold has been released
- `ui/Touchable` prop `holdConfig.global` to allow a hold to continue when leaving or blurring the element

### Changed

- All content-containing LESS stylesheets (not within a `styles` directory) extensions to be `*.module.less` to retain modular context with CLI 2.x.

### Fixed

- `i18n` resource loader to use intelligent defaults when the path variables are not injected
- `moonstone/VirtualList` to focus an item properly by `scrollTo` API immediately after a prior call to the same position
- `moonstone/Popup` to close floating layer when the popup closes without animation
- `spotlight` to improve prioritization of the contents of spotlight containers within overflow containers
- `spotlight/Spottable` and `spotlight/SpotlightContainerDecorator` to prevent focus when `spotlightDisabled` is set
- `spotlight/Spottable` to prevent emitting multiple click events when certain node types are selected via 5-way enter
- `ui/Touchable` to continue drag events when blurring the element when `dragConfig.global` is set
- `ui/Marquee` to marquee when necessary after a locale change

## [2.2.9] - 2019-01-11

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ npm run bootstrap
Unless otherwise specified, all content, including all source code files and
documentation files in this repository are:

Copyright (c) 2012-2018 LG Electronics
Copyright (c) 2012-2019 LG Electronics

Unless otherwise specified or set forth in the NOTICE file, all content,
including all source code files and documentation files in this repository are:
Expand Down
11 changes: 5 additions & 6 deletions docs/testing-components/test-driven-development/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ verify that an IconButton with `minWidth={true}` does not change the child compo
```js
describe('IconButton Specs', () => {

it('should always maintain minWidth=false for its <Button> child', function () {
test('should always maintain minWidth=false for its <Button> child', () => {
const iconButton = mount(
<IconButton minWidth>star</IconButton>
);
const button = iconButton.find('Button');
const expected = false;
const actual = (button.prop('minWidth'));

expect(actual).to.equal(expected);
expect(actual).toBe(expected);
});
});
```
Expand All @@ -64,15 +64,15 @@ This will make the test pass, but it's not a very useful IconButton. Let's add
properties are applied to the Button child.

```js
it('should apply same prop to <Button> child', function () {
test('should apply same prop to <Button> child', function () {
const iconButton = mount(
<IconButton small>star</IconButton>
);
const button = iconButton.find('Button');
const expected = true;
const actual = button.prop('small');

expect(actual).to.equal(expected);
expect(actual).toBe(expected);
});
```

Expand All @@ -85,8 +85,7 @@ solution.

## Test Method Introduction

We use Mocha and Chai together for our assertions. Chai provides fluent assertions we can use within our tests. While
there are quite a few comparisons it can help to stick to `.to.equal()` and `.to.not.equal()`. These methods come after
We use `Jest` for our unit testing. While there are quite a few comparisons it can help to stick to `.toBe()` and `.not.toBe()`. These methods come after
the `expect()` call.

We use Enzyme to render our components for testing. Enzyme can render a component in one of three different ways. Each
Expand Down
55 changes: 25 additions & 30 deletions docs/testing-components/unit-testing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ title: Unit Testing
### Running Tests

If you have created a enact project using the `enact cli` it will have everything you need
to run tests. For a single-run, execute `enact test start --single-run --browsers PhantomJS`.
to run tests. For a single-run, execute `enact test`.
You can also have the tests automatically run each time the filesystem changes simply with
`enact test start`. If you built your app using `enact cli` you can also use
`enact test`. If you built your app using `enact cli` you can also use
`npm run test` and `npm run test-watch` for short. Both commands will execute
the test suite and output the results to the console. If you are working on
framework modules, at a minimum you should perform the single test run on your
Expand All @@ -32,12 +32,9 @@ component or item under test and end with the `"-specs.js"` suffix.

We use a dizzying number of tools to perform unit testing. A quick overview of the different tools can be helpful.

* [Karma](https://karma-runner.github.io/1.0/index.html) - A tool for running tests in a browser (real or headless). This tool launches Mocha.
* [Mocha](https://mochajs.org/) - A test framework. This tool lets us set up suites of tests
* [Chai](http://chaijs.com/) - An assertion library. This library lets us write expressive tests in the suites. We use a wrapper called `dirty-chai` to avoid linting problems with Chai's use of properties for validation.
* [Sinon](http://sinonjs.org/) - A mock library. Useful for adding mocks and spies to components under test.
* [Jest](https://jestjs.io/) - A test framework. This tool allows us to setup, assert and run tests. We can also use `jest` as a mocking library.
* [Enzyme](http://airbnb.io/enzyme/) - A test library for use with React. It allows us to shallowly render components and inspect the output.
* [PhantomJS](http://phantomjs.org/) - A 'headless' browser. This allows us to execute tests quickly without having to launch a controlled browser environment and without having to actually render content to the screen.
* [jsdom](https://github.com/jsdom/jsdom) - A pure-JavaScript implementation of many web standards, notably the WHATWG DOM and HTML Standards, for use with Node.js.

## Unit Testing

Expand All @@ -46,10 +43,8 @@ We use a dizzying number of tools to perform unit testing. A quick overview of
Unit testing is the core of our testing platform. Unit testing only tests the smallest units of code. Typically a test
just tests a function/method. For Enact framework developers testing will also extend into component and virtual DOM testing.

We are using [Mocha](https://mochajs.org/) with [Chai](http://chaijs.com/) as our testing framework. We won't cover all the functions this gives us in this document. We
suggest looking at the [Chai API](http://chaijs.com/api/) after finishing this if you want to know all of the things Chai can give you.

We are also using Chai's [expect](http://chaijs.com/guide/styles/) syntax.
We are using [Jest](https://jestjs.io/) as our testing framework. We won't cover all the functions this gives us in this document. We
suggest looking at the [Jest Docs](https://jestjs.io/docs/en/api) after finishing this if you want to know all of the things Jest can give you.

Say you have a function like this:

Expand All @@ -59,14 +54,14 @@ const add = (numA, numB) => {
}
```

To test this function in mocha we could write something like:
To test this function in `Jest` we could write something like:

```js
it('Should add the two arguments together', () => {
test('Should add the two arguments together', () => {
const expected = 3;
const actual = add(1,2)

expect(actual).to.equal(expected);
expect(actual).toBe(expected);
});
```

Expand All @@ -93,21 +88,21 @@ code, but it does show where unit tests can break down because of certain assump
Something better would probably be:

```js
it('Should add the two arguments together', () => {
test('Should add the two arguments together', () => {
let expected = 3;
let actual = add(1,2);

expect(actual).to.equal(expected);
expect(actual).toBe(expected);

let expected = 30;
let actual = add(10,20);

expect(actual).to.equal(expected);
expect(actual).toBe(expected);

let expected = 123;
let actual = add(111, 12);

expect(actual).to.equal(expected);
expect(actual).toBe(expected);
});
```

Expand All @@ -126,14 +121,14 @@ const Text = (props) => {
return <p>{props.content}</p>;
}

it('Should contain text', () => {
const Text = shallow(
test('Should contain text', () => {
const subject = shallow(
<Text content='sample' />
);

const expected = 'sample';
const actual = Text.text()
expect(actual).to.equal(expected);
const actual = subject.text()
expect(actual).toBe(expected);
});
```

Expand Down Expand Up @@ -188,9 +183,9 @@ const returnArg (arg) => {
return arg;
}

it('Should return arg', () =>{
test('Should return arg', () =>{
const actual = returnArg('sample');
expect(actual).to.equal('sample');
expect(actual).toBe('sample');
});
```

Expand All @@ -208,26 +203,26 @@ const Text = (props) => {
}

//Example A - Bad
it('Should pass prop to component', () => {
test('Should pass prop to component', () => {
const Text = shallow(
<Text content='sample' />
);

const expected = 'sample';
const contentProp = Text.prop('content')
expect(contentProp).to.equal(expected);
expect(contentProp).toBe(expected);
});

//Example B - Better

it('Should contain text', () => {
const Text = shallow(
test('Should contain text', () => {
const subject = shallow(
<Text content='sample' />
);

const expected = 'sample';
const actual = Text.text()
expect(actual).to.equal(expected);
const actual = subject.text()
expect(actual).toBe(expected);
});
```

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "2.8.0",
"version": "2.2.9",
"version": "2.3.0-alpha.3",
"command": {
"bootstrap": {
"npmClientArgs": [
Expand Down
Loading

0 comments on commit 482a111

Please sign in to comment.