Coverage Summary for Class: ImageAttributesAttributeProvider (io.heapy.kotmark.ext.image.attributes.internal)

Class Method, % Branch, % Line, % Instruction, %
ImageAttributesAttributeProvider 100% (2/2) 100% (2/2) 100% (4/4) 100% (13/13)
ImageAttributesAttributeProvider$Companion 100% (1/1) 100% (1/1) 100% (4/4)
ImageAttributesAttributeProvider$setAttributes$1 100% (2/2) 50% (1/2) 100% (4/4) 100% (13/13)
Total 100% (5/5) 75% (3/4) 100% (9/9) 100% (30/30)


 package io.heapy.kotmark.ext.image.attributes.internal
 
 import io.heapy.kotmark.ext.image.attributes.ImageAttributes
 import io.heapy.kotmark.node.AbstractVisitor
 import io.heapy.kotmark.node.CustomNode
 import io.heapy.kotmark.node.Image
 import io.heapy.kotmark.node.Node
 import io.heapy.kotmark.renderer.html.AttributeProvider
 
 class ImageAttributesAttributeProvider private constructor() : AttributeProvider {
     override fun setAttributes(
         node: Node,
         tagName: String,
         attributes: MutableMap<String, String?>,
     ) {
         if (node !is Image) {
             return
         }
         node.accept(
             object : AbstractVisitor() {
                 override fun visit(customNode: CustomNode) {
                     if (customNode is ImageAttributes) {
                         attributes.putAll(customNode.attributes)
                         customNode.unlink()
                     }
                 }
             },
         )
     }
 
     companion object {
         fun create(): ImageAttributesAttributeProvider = ImageAttributesAttributeProvider()
     }
 }