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

test(table): table tests #2068

Merged
merged 3 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/hooks/render-tnode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ export function getParams(options?: OptionsType) {

// 同时支持驼峰命名和中划线命名的插槽,示例:value-display 和 valueDisplay
export function handleSlots(instance: ComponentPublicInstance, params: Record<string, any>, name: string) {
const finaleParams = h;
if (params) {
Object.assign(finaleParams, params);
}
// 检查是否存在 驼峰命名 的插槽
let node = instance.$slots[camelCase(name)]?.(params);
let node = instance.$slots[camelCase(name)]?.(finaleParams);
if (node) return node;
// 检查是否存在 中划线命名 的插槽
node = instance.$slots[kebabCase(name)]?.(params);
node = instance.$slots[kebabCase(name)]?.(finaleParams);
if (node) return node;
return null;
}
Expand Down
8 changes: 6 additions & 2 deletions src/hooks/tnode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ import {

// 兼容处理插槽名称,同时支持驼峰命名和中划线命名,示例:value-display 和 valueDisplay
function handleSlots(slots: SetupContext['slots'], name: string, params: Record<string, any>) {
const finaleParams = h;
if (params) {
Object.assign(finaleParams, params);
}
// 检查是否存在 驼峰命名 的插槽
let node = slots[camelCase(name)]?.(params);
let node = slots[camelCase(name)]?.(finaleParams);
if (node) return node;
// 检查是否存在 中划线命名 的插槽
node = slots[kebabCase(name)]?.(params);
node = slots[kebabCase(name)]?.(finaleParams);
if (node) return node;
return null;
}
Expand Down
10 changes: 1 addition & 9 deletions src/list/__tests__/__snapshots__/index.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,7 @@ exports[`List > :props > :asyncLoading is load-more 1`] = `
<div
class="t-list__load"
>
<div
class="t-loading--center t-size-m t-loading t-is-load-more"
>
<div
class="t-loading__text"
>
点击加载更多
</div>
</div>
<!---->
</div>
</div>
`;
Expand Down
2 changes: 2 additions & 0 deletions src/loading/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ export default mixins(classPrefixMixins).extend({
},

render() {
if (!this.loading) return null;

const defaultIndicator = <GradientIcon size={this.size} />;
const indicator = this.loading && renderTNodeJSX(this, 'indicator', defaultIndicator);
const text = this.showText && <div class={`${this.classPrefix}-loading__text`}>{renderTNodeJSX(this, 'text')}</div>;
Expand Down
Loading