From 28f7f31dd83f6c7b31d05654c085322237dc54c5 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 21 Oct 2020 22:11:16 +0800 Subject: [PATCH 1/4] fix ci --- tests/index.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/index.spec.js b/tests/index.spec.js index 955fb2b..ef7967e 100644 --- a/tests/index.spec.js +++ b/tests/index.spec.js @@ -212,7 +212,7 @@ describe('TextArea', () => { }, }, ]); - + await Promise.resolve(); expect(onResize).toHaveBeenCalledWith( expect.objectContaining({ width: expect.any(Number), From 5b1eb56f276c556e8fdf3a729aa4fae7dc45c331 Mon Sep 17 00:00:00 2001 From: Kermit Date: Thu, 17 Dec 2020 14:29:18 +0800 Subject: [PATCH 2/4] chore: use github actions (#6) --- .github/workflows/react-component-ci.yml | 114 +++++++++++++++++++++++ .travis.yml | 17 ---- README.md | 6 +- 3 files changed, 117 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/react-component-ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml new file mode 100644 index 0000000..432a3fb --- /dev/null +++ b/.github/workflows/react-component-ci.yml @@ -0,0 +1,114 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + setup: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@master + + - uses: actions/setup-node@v1 + with: + node-version: '12' + + - name: cache package-lock.json + uses: actions/cache@v2 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: create package-lock.json + run: npm i --package-lock-only + + - name: hack for singe file + run: | + if [ ! -d "package-temp-dir" ]; then + mkdir package-temp-dir + fi + cp package-lock.json package-temp-dir + + - name: cache node_modules + id: node_modules_cache_id + uses: actions/cache@v2 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: install + if: steps.node_modules_cache_id.outputs.cache-hit != 'true' + run: npm ci + + lint: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@master + + - name: restore cache from package-lock.json + uses: actions/cache@v2 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v2 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: lint + run: npm run lint + + needs: setup + + compile: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@master + + - name: restore cache from package-lock.json + uses: actions/cache@v2 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v2 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: compile + run: npm run compile + + needs: setup + + coverage: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@master + + - name: restore cache from package-lock.json + uses: actions/cache@v2 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v2 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: coverage + run: npm test -- --coverage && bash <(curl -s https://codecov.io/bash) + + needs: setup diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d2427f2..0000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: node_js - -node_js: - - 10 - -script: -- | - if [ "$TEST_TYPE" = test ]; then - npm run coverage && \ - bash <(curl -s https://codecov.io/bash) - else - npm run $TEST_TYPE - fi -env: - matrix: - - TEST_TYPE=lint - - TEST_TYPE=test diff --git a/README.md b/README.md index 9fffd51..d844907 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] -[![build status][travis-image]][travis-url] +[![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![Dependencies][david-image]](david-url) [![DevDependencies][david-dev-image]][david-dev-url] @@ -10,8 +10,8 @@ [npm-image]: http://img.shields.io/npm/v/rc-textarea.svg?style=flat-square [npm-url]: http://npmjs.org/package/rc-textarea -[travis-image]: https://img.shields.io/travis/com/react-component/textarea.svg?style=flat-square -[travis-url]: https://travis-ci.com/react-component/textarea +[github-actions-image]: https://github.com/react-component/textarea/workflows/CI/badge.svg +[github-actions-url]: https://github.com/react-component/textarea/actions [codecov-image]: https://img.shields.io/codecov/c/github/react-component/textarea/master.svg?style=flat-square [codecov-url]: https://codecov.io/gh/react-component/textarea/branch/master [david-url]: https://david-dm.org/react-component/textarea From 842bf80819b794f1708ef4b5f9302074873cdb9f Mon Sep 17 00:00:00 2001 From: Kermit Date: Thu, 17 Dec 2020 15:24:39 +0800 Subject: [PATCH 3/4] fix: resize style should be none when using autoSize (#7) * fix: resize style should be none when using autoSize * fix: test case --- src/calculateNodeHeight.tsx | 4 ++-- tests/index.spec.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calculateNodeHeight.tsx b/src/calculateNodeHeight.tsx index 1fbd945..b4b518f 100644 --- a/src/calculateNodeHeight.tsx +++ b/src/calculateNodeHeight.tsx @@ -92,7 +92,7 @@ export default function calculateNodeHeight( useCache = false, minRows: number | null = null, maxRows: number | null = null, -) { +): React.CSSProperties { if (!hiddenTextarea) { hiddenTextarea = document.createElement('textarea'); hiddenTextarea.setAttribute('tab-index', '-1'); @@ -162,5 +162,5 @@ export default function calculateNodeHeight( height = Math.min(maxHeight, height); } } - return { height, minHeight, maxHeight, overflowY }; + return { height, minHeight, maxHeight, overflowY, resize: 'none' }; } diff --git a/tests/index.spec.js b/tests/index.spec.js index ef7967e..caba8dc 100644 --- a/tests/index.spec.js +++ b/tests/index.spec.js @@ -135,6 +135,7 @@ describe('TextArea', () => { maxHeight: 9007199254740991, minHeight: 2, overflowY: undefined, + resize: 'none', }); wrapper.style.boxSizing = 'content-box'; expect(calculateNodeHeight(wrapper, 1, 1)).toEqual({ @@ -142,6 +143,7 @@ describe('TextArea', () => { maxHeight: 9007199254740991, minHeight: -4, overflowY: undefined, + resize: 'none', }); }); From c5b97005782075a47501a69cf9d44607d7684421 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 17 Dec 2020 15:33:27 +0800 Subject: [PATCH 4/4] 0.3.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a6f25a5..c09bb29 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rc-textarea", - "version": "0.3.1", + "version": "0.3.2", "description": "Pretty Textarea react component used in used in ant.design", "keywords": [ "react",