@@ -551,6 +551,45 @@ defmodule YexXmlElementTest do
551551 % { doc: d1 , xml_fragment: f }
552552 end
553553
554+ test "insert prelim with any attribute types" , % { xml_fragment: xml_fragment } do
555+ assert :ok ==
556+ Yex.XmlFragment . insert ( xml_fragment , 0 , % Yex.XmlElementPrelim {
557+ tag: "blockContainer" ,
558+ attributes: % { "id" => "f6d3b168-05b2-4eb7-8d4e-132beb6fdc5b" } ,
559+ children: [
560+ % Yex.XmlElementPrelim {
561+ tag: "checkListItem" ,
562+ attributes: % {
563+ "backgroundColor" => "default" ,
564+ "checked" => false ,
565+ "data" => % { "custom" => "data" } ,
566+ "indentation" => 0 ,
567+ "itemType" => << 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 >> ,
568+ "lineHeight" => 1.5 ,
569+ "array" => [ 1 , 2 , 3 ] ,
570+ "textAlignment" => "left" ,
571+ "textColor" => "default"
572+ } ,
573+ children: [ ]
574+ }
575+ ]
576+ } )
577+
578+ { :ok , root } = Yex.XmlFragment . fetch ( xml_fragment , 0 )
579+ assert "blockContainer" == Yex.XmlElement . get_tag ( root )
580+ assert "f6d3b168-05b2-4eb7-8d4e-132beb6fdc5b" == Yex.XmlElement . get_attribute ( root , "id" )
581+
582+ { :ok , child } = Yex.XmlElement . fetch ( root , 0 )
583+ assert false == Yex.XmlElement . get_attribute ( child , "checked" )
584+ assert 0 == Yex.XmlElement . get_attribute ( child , "indentation" )
585+ assert 1.5 == Yex.XmlElement . get_attribute ( child , "lineHeight" )
586+ assert [ 1 , 2 , 3 ] == Yex.XmlElement . get_attribute ( child , "array" )
587+ assert % { "custom" => "data" } == Yex.XmlElement . get_attribute ( child , "data" )
588+
589+ assert << 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 >> ==
590+ Yex.XmlElement . get_attribute ( child , "itemType" )
591+ end
592+
554593 test "XmlElementPrelim.new" , % { xml_fragment: xml_fragment } do
555594 XmlFragment . push (
556595 xml_fragment ,
0 commit comments