Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ describe('skeleton-item module', () => {
template: `<d-skeleton-item :shape="'avatar'" style="margin-left:55px;width:80px;height:80px;" />`,
});

expect(wrapper.find('.devui-skeleton__shape__avatar').element.getAttribute('style')).toBe('border-radius: 50%; margin-left: 55px; width: 80px; height: 80px;');
expect(wrapper.find('.devui-skeleton__shape__avatar').element.getAttribute('style'))
.toBe('border-radius: 50%; margin-left: 55px; width: 80px; height: 80px;');
});

it('render skeleton-item-avatar without animation', () => {
Expand Down
7 changes: 4 additions & 3 deletions packages/devui-vue/devui/skeleton/src/item/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default defineComponent({
}

function renderAvatarStyle(avatarShape) {
function renderAvatarShape(avatarShape) {
function renderAvatarShape() {
return avatarShape === 'square' ? '' : 'border-radius:50%;';
}

Expand All @@ -68,15 +68,16 @@ export default defineComponent({
switch (props.shape) {
case 'avatar':
return <>
<div class={`devui-skeleton__shape__avatar ${renderAnimate(props.animate)}`} style={renderAvatarStyle(props.avatarShape)} {...ctx.attrs} />
<div class={`devui-skeleton__shape__avatar ${renderAnimate(props.animate)}`}
style={renderAvatarStyle(props.avatarShape)} {...ctx.attrs} />
</>;
case 'paragraph':
return <>
{renderShapeParagraph(props.row, props.rowWidth, props.round)}
</>;
default:
return <>
<div class={`devui-skeleton__shape__${props.shape} ${renderAnimate(props.animate)}`} {...ctx.attrs}/>
<div class={`devui-skeleton__shape__${props.shape} ${renderAnimate(props.animate)}`} {...ctx.attrs} />
</>;
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/devui-vue/devui/skeleton/src/skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ export default defineComponent({
}

function renderAvatarStyle(avatarSize, avatarShape) {
function renderAvatarShape(avatarShape) {
function renderAvatarShape() {
return avatarShape === 'square' ? '' : 'border-radius:50%;';
}
function renderAvatarSize(avatarSize) {
function renderAvatarSize() {
switch (typeof avatarSize) {
case 'string':
return `width:${avatarSize};height:${avatarSize};`;
Expand All @@ -73,15 +73,15 @@ export default defineComponent({
return (renderAvatarSize(avatarSize) + renderAvatarShape(avatarShape));
}
function renderTitle(isVisible, titleWidth, isRound) {
function renderTitleWidth(titleWidth) {
function renderTitleWidth() {
switch (typeof titleWidth) {
case 'string':
return `width: ${titleWidth};`;
case 'number':
return `width: ${titleWidth}px;`;
}
}
function renderTitleVisibility(isVisible) {
function renderTitleVisibility() {
return isVisible ? null : 'visibility: hidden;';
}

Expand Down