Skip to content
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

fix(area): columns-placeholder prop rendering error #12857

Merged
merged 4 commits into from May 18, 2024

Conversation

yipl95
Copy link
Contributor

@yipl95 yipl95 commented May 11, 2024

Before submitting a pull request, please read the contributing guide.

在提交 pull request 之前,请阅读 贡献指南

bugfix #12856

当传入 placeholder 后,处理 数据有点问题,尝试如下修改:
image

@codecov-commenter
Copy link

codecov-commenter commented May 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.76%. Comparing base (8cb3fe5) to head (a3e464f).
Report is 5 commits behind head on main.

Current head a3e464f differs from pull request most recent head e825a1f

Please upload reports for the commit e825a1f to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12857      +/-   ##
==========================================
+ Coverage   89.67%   89.76%   +0.08%     
==========================================
  Files         257      257              
  Lines        6957     6957              
  Branches     1711     1711              
==========================================
+ Hits         6239     6245       +6     
+ Misses        382      379       -3     
+ Partials      336      333       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@inottn
Copy link
Collaborator

inottn commented May 11, 2024

可以补充一下对应的单测

@yipl95
Copy link
Contributor Author

yipl95 commented May 11, 2024

@inottn 已添加单测,测试结果如下:
area-placeholder-fix

单测运行结果:
image
image

@inottn
Copy link
Collaborator

inottn commented May 11, 2024

@inottn 已添加单测,测试结果如下: area-placeholder-fix area-placeholder-fix

单测运行结果: image image

嗯,这个是 demo 的快照测试,没有覆盖到本次 PR 对应的 issue。可以试着编写一个单测,确保它在这个 PR 前运行失败,在这个 PR 后运行成功。

@yipl95
Copy link
Contributor Author

yipl95 commented May 11, 2024

get~ 我试下

@yipl95
Copy link
Contributor Author

yipl95 commented May 11, 2024

@inottn 大佬看下是否符合预期,新增单测用例如下:

test('should columns placeholder displayed normally', async () => {
  const columnsPlaceholder = ['省份', '城市', '区县']

  const wrapper = mount(Area, {
    props: {
      areaList,
      columnsPlaceholder,
    },
  });

  const columns = await wrapper.findAll('.van-picker-column');
  // 点击省份(第一列第二行)
  await columns[0].findAll('li')?.[1].trigger('click');
  // 点击后获取第二列第一行内容,判断是否 === columnsPlaceholder[1] => '城市'
  expect(columns[1].find('li').text()).toBe(columnsPlaceholder[1])

  // 点击城市(第二列第二行)
  await columns[1].findAll('li')?.[1].trigger('click');
  // 点击后获取第三列第一行内容,判断是否 === columnsPlaceholder[2] => '区县'
  expect(columns[2].find('li').text()).toBe(columnsPlaceholder[2])
});

修改前:
image

修改后:
image

@chenjiahan chenjiahan changed the title fix: (area)columns-placeholder属性显示异常 fix(area): columns-placeholder prop rendering error May 18, 2024
@chenjiahan
Copy link
Member

Thanks! ❤️

@chenjiahan chenjiahan enabled auto-merge (squash) May 18, 2024 12:44
@chenjiahan chenjiahan merged commit db1adf6 into youzan:main May 18, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants