Răsfoiți Sursa

fix ci around autofmt

Jonathan Kelley 2 ani în urmă
părinte
comite
aa0f6812fa

+ 1 - 1
packages/autofmt/src/element.rs

@@ -66,7 +66,7 @@ impl Writer<'_> {
 
         // check if we have a lot of attributes
         let attr_len = self.is_short_attrs(attributes);
-        let is_short_attr_list = attr_len < 80;
+        let is_short_attr_list = (attr_len + self.out.indent * 4) < 80;
         let children_len = self.is_short_children(children);
         let is_small_children = children_len.is_some();
 

+ 11 - 2
packages/autofmt/tests/samples/attributes.rsx

@@ -45,6 +45,15 @@ rsx! {
         a: "123"
     }
 
-    // Short attributes
-    div { a: "123", a: "123", a: "123", a: "123", a: "123", a: "123", a: "123", a: "123", a: "123" }
+    div {
+        a: "123",
+        a: "123",
+        a: "123",
+        a: "123",
+        a: "123",
+        a: "123",
+        a: "123",
+        a: "123",
+        a: "123"
+    }
 }

+ 4 - 1
packages/autofmt/tests/samples/long.rsx

@@ -33,6 +33,9 @@ pub fn Explainer<'a>(
     }
 
     cx.render(rsx! {
-        div { class: "flex flex-wrap items-center dark:text-white py-16 border-t font-light", left, right }
+        div { class: "flex flex-wrap items-center dark:text-white py-16 border-t font-light",
+            left,
+            right
+        }
     })
 }

+ 12 - 15
packages/autofmt/tests/samples/reallylong.rsx

@@ -1,18 +1,15 @@
 pub static Icon3: Component<()> = |cx| {
-    cx.render(rsx!(svg { class: "w-6 h-6",
-        stroke_linecap: "round",
-        fill: "none",
-        stroke_linejoin: "round",
-        stroke_width: "2",
-        stroke: "currentColor",
-        view_box: "0 0 24 24",
-        path {
-            d: "M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2",
+    cx.render(rsx! {
+        svg {
+            class: "w-6 h-6",
+            stroke_linecap: "round",
+            fill: "none",
+            stroke_linejoin: "round",
+            stroke_width: "2",
+            stroke: "currentColor",
+            view_box: "0 0 24 24",
+            path { d: "M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2" }
+            circle { cx: "12", cy: "7", r: "4" }
         }
-        circle {
-            cx: "12",
-            cy: "7",
-            r: "4",
-        }
-    }))
+    })
 };

+ 3 - 1
packages/autofmt/tests/samples/simple.rsx

@@ -37,7 +37,9 @@ rsx! {
 
     // One level compression
     div {
-        a { class: "py-2 px-3 bg-indigo-500 hover:bg-indigo-600 rounded text-xs text-white", href: "#",
+        a {
+            class: "py-2 px-3 bg-indigo-500 hover:bg-indigo-600 rounded text-xs text-white",
+            href: "#",
             "Send invitation"
         }
     }

+ 4 - 1
packages/autofmt/tests/wrong/multiexpr.rsx

@@ -1,5 +1,8 @@
 fn ItWroks() {
     cx.render(rsx! {
-        div { class: "flex flex-wrap items-center dark:text-white py-16 border-t font-light", left, right }
+        div { class: "flex flex-wrap items-center dark:text-white py-16 border-t font-light",
+            left,
+            right
+        }
     })
 }