New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Avatar): expose onError #11285

Merged
merged 2 commits into from Jul 24, 2018

Conversation

Projects
None yet
5 participants
@paranoidjk
Member

paranoidjk commented Jul 16, 2018

Moved from #11267

First of all, thank you for your contribution! :-)

Please makes sure that these checkboxes are checked before submitting your PR, thank you!

  • Make sure that you propose PR to right branch: bugfix for master, feature for latest active branch feature-x.x.
  • Make sure that you follow antd's code convention.
  • Run npm run lint and fix those errors before submitting in order to keep consistent code style.
  • Rebase before creating a PR to keep commit history clear.
  • Add some descriptions and refer relative issues for you PR.

Extra checklist:

if isBugFix :

  • Make sure that you add at least one unit test for the bug which you had fixed.

elif isNewFeature :

  • Update API docs for the component.
  • Update/Add demo to demonstrate new feature.
  • Update TypeScript definition for the component.
  • Add unit tests for the feature.

@paranoidjk paranoidjk referenced this pull request Jul 16, 2018

Closed

feat(Avatar): expose onError #11267

0 of 10 tasks complete
@ant-design-bot

This comment has been minimized.

ant-design-bot commented Jul 16, 2018

Deploy preview for ant-design ready!

Built with commit f452372

https://deploy-preview-11285--ant-design.netlify.com

@codecov

This comment has been minimized.

codecov bot commented Jul 16, 2018

Codecov Report

Merging #11285 into feature-3.8.0 will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@                Coverage Diff                @@
##           feature-3.8.0   #11285      +/-   ##
=================================================
+ Coverage          91.76%   91.76%   +<.01%     
=================================================
  Files                199      199              
  Lines               5000     5004       +4     
  Branches            1401     1403       +2     
=================================================
+ Hits                4588     4592       +4     
  Misses               407      407              
  Partials               5        5
Impacted Files Coverage Δ
components/avatar/index.tsx 97.72% <100%> (+0.22%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 11f0f14...f452372. Read the comment docs.

handleImgLoadError = () => {
const { onError } = this.props;
const errorFlag = onError ? onError() : undefined;
if (errorFlag !== false) {

This comment has been minimized.

@afc163

afc163 Jul 16, 2018

Member

这句没覆盖到。

This comment has been minimized.

@paranoidjk

paranoidjk Jul 16, 2018

Member

2018-07-16 2 11 49

是旧的用例其实一直有问题,手动操作的 state,没有按 simulate 交互事件的方式去测试,我来把这个坑填下把

@paranoidjk

This comment has been minimized.

Member

paranoidjk commented Jul 16, 2018

Summary of all failing tests
 FAIL  components/drawer/__tests__/Drawer.test.js
  ● Drawer › render correctly

    expect(value).toMatchSnapshot()

    Received value does not match stored snapshot "Drawer render correctly 1".

    - Snapshot
    + Received

    @@ -7,10 +7,11 @@
          <div
            class="ant-drawer-mask"
          />
          <div
            class="ant-drawer-content-wrapper"
    +       style=""
          >
            <div
              class="ant-drawer-content"
            >
              <div

      14 |       </Drawer>
      15 |     );
    > 16 |     expect(wrapper.render()).toMatchSnapshot();
         |                              ^
      17 |   });
      18 |
      19 |   it('have a title', () => {

      at Object.<anonymous> (components/drawer/__tests__/Drawer.test.js:16:30)

  ● Drawer › have a title

    expect(value).toMatchSnapshot()

    Received value does not match stored snapshot "Drawer have a title 1".

    - Snapshot
    + Received

    @@ -7,10 +7,11 @@
          <div
            class="ant-drawer-mask"
          />
          <div
            class="ant-drawer-content-wrapper"
    +       style=""
          >
            <div
              class="ant-drawer-content"
            >
              <div

      27 |       </Drawer>
      28 |     );
    > 29 |     expect(wrapper.render()).toMatchSnapshot();
         |                              ^
      30 |   });
      31 |
      32 |   it('closable is false', () => {

      at Object.<anonymous> (components/drawer/__tests__/Drawer.test.js:29:30)

  ● Drawer › closable is false

    expect(value).toMatchSnapshot()

    Received value does not match stored snapshot "Drawer closable is false 1".

    - Snapshot
    + Received

    @@ -7,10 +7,11 @@
          <div
            class="ant-drawer-mask"
          />
          <div
            class="ant-drawer-content-wrapper"
    +       style=""
          >
            <div
              class="ant-drawer-content"
            >
              <div

      40 |       </Drawer>
      41 |     );
    > 42 |     expect(wrapper.render()).toMatchSnapshot();
         |                              ^
      43 |   });
      44 |
      45 |   it('destroyOnClose is true', () => {

      at Object.<anonymous> (components/drawer/__tests__/Drawer.test.js:42:30)

  ● Drawer › destroyOnClose is true

    expect(value).toMatchSnapshot()

    Received value does not match stored snapshot "Drawer destroyOnClose is true 1".

    - Snapshot
    + Received

    @@ -7,10 +7,11 @@
          <div
            class="ant-drawer-mask"
          />
          <div
            class="ant-drawer-content-wrapper"
    +       style="transform: translateX(100%);"
          >
            <div
              class="ant-drawer-content"
            />
          </div>

      53 |       </Drawer>
      54 |     );
    > 55 |     expect(wrapper.render()).toMatchSnapshot();
         |                              ^
      56 |   });
      57 | });
      58 |

      at Object.<anonymous> (components/drawer/__tests__/Drawer.test.js:55:30)

 FAIL  components/drawer/__tests__/DrawerEvent.test.js (5.481s)
  ● Drawer › render correctly

    expect(value).toMatchSnapshot()

    Received value does not match stored snapshot "Drawer render correctly 1".

    - Snapshot
    + Received

    @@ -16,10 +16,11 @@
            <div
              class="ant-drawer-mask"
            />
            <div
              class="ant-drawer-content-wrapper"
    +         style=""
            >
              <div
                class="ant-drawer-content"
              >
                <div

      57 |     expect(content).toBe('Here is content of Drawer');
      58 |
    > 59 |     expect(wrapper.render()).toMatchSnapshot();
         |                              ^
      60 |   });
      61 |
      62 |   it('mask trigger onClose', () => {

      at Object.<anonymous> (components/drawer/__tests__/DrawerEvent.test.js:59:30)


Snapshot Summary
 › 5 snapshots failed from 2 test suites. Inspect your code changes or run `npm test -- -u` to update them.

Test Suites: 2 failed, 127 passed, 129 total
Tests:       5 failed, 2 skipped, 820 passed, 827 total
Snapshots:   5 failed, 509 passed, 514 total
Time:        79.782s
Ran all test suites.

Drawer 的 Snapshot 都多了一个 style,@chenshuai2144 是否是你发的新版本的缘故? https://github.com/react-component/drawer/commits/master

@IssuehuntBot

This comment has been minimized.

IssuehuntBot commented Jul 17, 2018

@0maxxam0 funded this issue with $5. Visit this issue on Issuehunt

@yesmeck yesmeck merged commit ecff499 into feature-3.8.0 Jul 24, 2018

7 checks passed

WIP ready for review
Details
codecov/patch 100% of diff hit (target 91.76%)
Details
codecov/project 91.76% (+<.01%) compared to 11f0f14
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details
security/snyk - package.json No dependency changes
Details

@yesmeck yesmeck deleted the feat/avatar-onerror branch Jul 24, 2018

@IssuehuntBot

This comment has been minimized.

IssuehuntBot commented Jul 24, 2018

@IssuehuntBot

This comment has been minimized.

IssuehuntBot commented Jul 24, 2018

@IssuehuntBot

This comment has been minimized.

IssuehuntBot commented Jul 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment