You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

88 lines
2.1 KiB

import { Component, Vue, Prop } from "vue-facing-decorator";
/**
* ProjectIcon Mock Component
*
* A mock implementation of the ProjectIcon component for testing purposes.
* Provides the same interface as the original component but with simplified behavior
* for unit testing scenarios.
*
* @author Matthew Raymer
*/
@Component({ name: "ProjectIcon" })
export default class ProjectIconMock extends Vue {
@Prop entityId = "";
@Prop iconSize = 0;
@Prop imageUrl = "";
@Prop linkToFullImage = false;
/**
* Mock method to check if component should show image
* @returns boolean - true if image should be displayed
*/
get shouldShowImage(): boolean {
return !!this.imageUrl;
}
/**
* Mock method to check if component should be a link
* @returns boolean - true if component should be a link
*/
get shouldBeLink(): boolean {
return this.linkToFullImage && !!this.imageUrl;
}
/**
* Mock method to get container CSS classes
* @returns string - CSS classes for the container
*/
get containerClasses(): string {
return "h-full w-full object-contain";
}
/**
* Mock method to get image CSS classes
* @returns string - CSS classes for the image
*/
get imageClasses(): string {
return "w-full h-full object-contain";
}
/**
* Mock method to generate icon HTML
* @returns string - HTML for the icon
*/
generateIcon(): string {
if (this.imageUrl) {
return `<img src="${this.imageUrl}" class="${this.imageClasses}" />`;
} else {
return `<svg class="jdenticon" width="${this.iconSize}" height="${this.iconSize}"></svg>`;
}
}
/**
* Mock method to get blank config
* @returns object - Blank configuration for jdenticon
*/
get blankConfig() {
return {
lightness: {
color: [1.0, 1.0],
grayscale: [1.0, 1.0],
},
saturation: {
color: 0.0,
grayscale: 0.0,
},
backColor: "#0000",
};
}
/**
* Mock method to check if should use blank config
* @returns boolean - true if blank config should be used
*/
get shouldUseBlankConfig(): boolean {
return !this.entityId;
}
}