Skip to content

Commit

Permalink
* Update dependencies
Browse files Browse the repository at this point in the history
* Migrate to [email protected]
  • Loading branch information
shamcode committed May 31, 2021
1 parent f5ce4f8 commit e8cbcdd
Show file tree
Hide file tree
Showing 34 changed files with 1,330 additions and 1,404 deletions.
6 changes: 6 additions & 0 deletions .babel-plugin-macrosrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
'ref': {
'enabled': [ 'enabled', 'uniq' ].includes( process.env.MACRO_REF_REPLACE ),
'uniq': 'uniq' === process.env.MACRO_REF_REPLACE
}
};
29 changes: 29 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"presets": [
[
"@babel/env",
{
"useBuiltIns": "usage",
"corejs": 3,
"shippedProposals": true,
"exclude": [
"web.immediate",
"web.dom-collections.iterator",
"es.array.iterator",
"es.array.reverse",
"es.string.trim"
]
}
]
],
"plugins": [
"@babel/plugin-proposal-function-bind",
[
"@babel/plugin-proposal-object-rest-spread",
{
"useBuiltIns": true
}
],
"macros"
]
}
3 changes: 3 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
> 1%
not dead
not ie <= 11
6 changes: 4 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ module.exports = {
"sourceType": "module"
},
"globals": {
"Template": true
"Template": true,
"ref": true,
"Component": true
},
"plugins": [
"html",
Expand Down Expand Up @@ -177,4 +179,4 @@ module.exports = {
],
"no-multiple-empty-lines": 2,
}
};
};
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
node_modules/
.idea
coverage/
/index.js
/active-page-container.js
/link-to.js
/href-to.js
/params.js
/storage.js
/lib
/module
/demo-app/dist
13 changes: 9 additions & 4 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ node_modules

.DS_Store
.idea
.babel-plugin-macrosrc.js
.babelrc
.browserslistrc
.eslintrc.js
.stylelintrc
.travis.yml
.size-limit.json
jest.config.js
rollup.config.js
yarn-error.log
Thumbs.db

/coverage/
/src/
/demo-app/
/__tests__/
/__mocks__/
TODO.md
webpack.config.js
yarn-error.log
.travis.yml
10 changes: 10 additions & 0 deletions .size-limit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"path": "module/index.js",
"ignore": [
"sham-ui",
"sham-ui-data-storage"
],
"limit": "4 KB"
}
]
3 changes: 3 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "stylelint-config-recommended-scss"
}
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: node_js
node_js:
- "8"
- "14"
script:
- yarn test:coverage
- yarn test:coverage
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 5.0.0-alpha.1
* Update dependencies
* Migrate to [email protected]

## 4.3.1
* Update dependencies

Expand Down
7 changes: 0 additions & 7 deletions TODO.md

This file was deleted.

29 changes: 18 additions & 11 deletions __tests__/unit/components/ActivePageContainer.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,57 @@
import { DI } from 'sham-ui';
import { createDI } from 'sham-ui';
import { storage } from '../../../src/storage';
import ActivePageContainer from '../../../src/components/ActivePageContainer';
import ActivePageContainer from '../../../src/ActivePageContainer';
import renderer, { compile } from 'sham-ui-test-helpers';

const DI = createDI();

afterEach( () => {
DI.resolve( 'router:storage' ).reset();
} );

it( 'renders correctly', () => {
const generateMock = jest.fn();

const routerStorage = storage( DI );

DI.bind( 'router', {
storage,
storage: routerStorage,
generate: generateMock
} );
storage.activePageComponent = compile`
routerStorage.activePageComponent = compile`
<h1>Title</h1>
<div>Content for dummy component</div>
`;
storage.activePageOptions = {
routerStorage.activePageOptions = {
path: 'base',
text: 'Base page'
};
storage.sync();
routerStorage.sync();

generateMock.mockReturnValue( '/base' );

const meta = renderer( ActivePageContainer, {} );
const meta = renderer( ActivePageContainer, { DI } );
expect( meta.toJSON() ).toMatchSnapshot();
} );

it( 'correct process dynamic placet', () => {
const generateMock = jest.fn();

const routerStorage = storage( DI );

DI.bind( 'router', {
storage,
storage: routerStorage,
generate: generateMock
} );
storage.activePageComponent = compile`
routerStorage.activePageComponent = compile`
<h1>Title</h1>
<div>Content for dummy component</div>
`;
storage.activePageOptions = {
routerStorage.activePageOptions = {
path: 'base',
text: 'Base page'
};
storage.sync();
routerStorage.sync();

generateMock.mockReturnValue( '/base' );

Expand All @@ -62,6 +68,7 @@ it( 'correct process dynamic placet', () => {
{% endif %}
`,
{
DI,
withWrapper: false
}
);
Expand Down
45 changes: 30 additions & 15 deletions __tests__/unit/components/LinkTo.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { DI } from 'sham-ui';
import { createDI } from 'sham-ui';
import { storage } from '../../../src/storage';
import LinkTo from '../../../src/components/LinkTo.sfc';
import hrefto from '../../../src/directives/href-to';
import renderer from 'sham-ui-test-helpers';

const DI = createDI();

afterEach( () => {
DI.bind( 'router', null );
DI.resolve( 'router:storage' ).reset();
Expand All @@ -12,13 +14,14 @@ afterEach( () => {
it( 'render correctly', () => {
const generateMock = jest.fn();
DI.bind( 'router', {
storage,
storage: storage( DI ),
generate: generateMock
} );

generateMock.mockReturnValueOnce( '/base' );

const meta = renderer( LinkTo, {
DI,
path: 'base',
text: 'Base page',
directives: {
Expand All @@ -33,13 +36,14 @@ it( 'render correctly', () => {
it( 'params options', () => {
const generateMock = jest.fn();
DI.bind( 'router', {
storage,
storage: storage( DI ),
generate: generateMock
} );

generateMock.mockReturnValueOnce( '/base/1' );

const meta = renderer( LinkTo, {
DI,
path: 'base',
params: {
id: 1
Expand All @@ -56,16 +60,19 @@ it( 'params options', () => {
it( 'useActiveClass options', () => {
const generateMock = jest.fn();

const routerStorage = storage( DI );

DI.bind( 'router', {
storage,
storage: routerStorage,
generate: generateMock
} );

generateMock.mockReturnValue( '/base' );
storage.url = '/base';
storage.sync();
routerStorage.url = '/base';
routerStorage.sync();

const meta = renderer( LinkTo, {
DI,
path: 'base',
useActiveClass: true,
directives: {
Expand All @@ -80,16 +87,19 @@ it( 'useActiveClass options', () => {
it( 'activeClass options', () => {
const generateMock = jest.fn();

const routerStorage = storage( DI );

DI.bind( 'router', {
storage,
storage: routerStorage,
generate: generateMock
} );

generateMock.mockReturnValueOnce( '/base' );
storage.url = '/base';
storage.sync();
routerStorage.url = '/base';
routerStorage.sync();

const meta = renderer( LinkTo, {
DI,
path: 'base',
useActiveClass: true,
activeClass: 'test-active',
Expand All @@ -103,13 +113,14 @@ it( 'activeClass options', () => {
it( 'className option', () => {
const generateMock = jest.fn();
DI.bind( 'router', {
storage,
storage: storage( DI ),
generate: generateMock
} );

generateMock.mockReturnValueOnce( '/base' );

const meta = renderer( LinkTo, {
DI,
path: 'base',
text: 'Base page',
className: 'foo bar',
Expand All @@ -124,16 +135,18 @@ it( 'className option', () => {
it( 'className option & useActiveClass & activeClass', () => {
const generateMock = jest.fn();

const routerStorage = storage( DI );
DI.bind( 'router', {
storage,
storage: routerStorage,
generate: generateMock
} );

generateMock.mockReturnValueOnce( '/base' );
storage.url = '/base';
storage.sync();
routerStorage.url = '/base';
routerStorage.sync();

const meta = renderer( LinkTo, {
DI,
path: 'base',
useActiveClass: true,
activeClass: 'test-active',
Expand All @@ -151,14 +164,15 @@ it( 'click', () => {
const navigateMock = jest.fn();

DI.bind( 'router', {
storage,
storage: storage( DI ),
generate: generateMock,
navigate: navigateMock
} );

generateMock.mockReturnValueOnce( '/base' );

const meta = renderer( LinkTo, {
DI,
path: 'base',
directives: {
'hrefto': hrefto
Expand All @@ -174,13 +188,14 @@ it( 'click', () => {
it( 'remove', () => {
const generateMock = jest.fn();
DI.bind( 'router', {
storage,
storage: storage( DI ),
generate: generateMock
} );

generateMock.mockReturnValueOnce( '/base' );

const meta = renderer( LinkTo, {
DI,
path: 'base',
text: 'Base page',
directives: {
Expand Down
Loading

0 comments on commit e8cbcdd

Please sign in to comment.