Skip to content

Commit

Permalink
add list style position and type
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartaccent committed May 25, 2024
1 parent 02d179e commit 2f9cc62
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Added new props:
- column-gap
- row-gap
- box-sizing
- list-style-position
- list-style-type

### v0.0.5

Expand Down
12 changes: 12 additions & 0 deletions props/list_style_position.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package props

type ListStylePosition string

const (
ListStylePositionInside ListStylePosition = "inside"
ListStylePositionOutside ListStylePosition = "outside"
)

func (l ListStylePosition) String() string {
return string(l)
}
13 changes: 13 additions & 0 deletions props/list_style_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package props

type ListStyleType string

const (
ListStyleTypeNone ListStyleType = "none"
ListStyleTypeDisc ListStyleType = "disc"
ListStyleTypeDecimal ListStyleType = "decimal"
)

func (l ListStyleType) String() string {
return string(l)
}
2 changes: 2 additions & 0 deletions style.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ type (
JustifySelf props.JustifySelf `css:"justify-self"`
Left props.Unit `css:"left"`
LineHeight props.Unit `css:"line-height"`
ListStylePosition props.ListStylePosition `css:"list-style-position"`
ListStyleType props.ListStyleType `css:"list-style-type"`
Margin props.Unit `css:"margin"`
MarginBottom props.Unit `css:"margin-bottom"`
MarginLeft props.Unit `css:"margin-left"`
Expand Down
27 changes: 27 additions & 0 deletions style_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,33 @@ func TestStyle_Left(t *testing.T) {
}
}

func TestStyle_ListStylePosition(t *testing.T) {
testCases := map[props.ListStylePosition]string{
props.ListStylePositionInside: "inside",
props.ListStylePositionOutside: "outside",
}

for prop, expected := range testCases {
st := &Style{Selector: ".test", Props: Props{ListStylePosition: prop}}
css := fmt.Sprintf(".test{list-style-position:%s;}", expected)
runTest(t, st, css)
}
}

func TestStyle_ListStyleType(t *testing.T) {
testCases := map[props.ListStyleType]string{
props.ListStyleTypeNone: "none",
props.ListStyleTypeDisc: "disc",
props.ListStyleTypeDecimal: "decimal",
}

for prop, expected := range testCases {
st := &Style{Selector: ".test", Props: Props{ListStyleType: prop}}
css := fmt.Sprintf(".test{list-style-type:%s;}", expected)
runTest(t, st, css)
}
}

func TestStyle_LineHeight(t *testing.T) {
testCases := map[props.Unit]string{
props.UnitRaw(1.5): "1.5",
Expand Down

0 comments on commit 2f9cc62

Please sign in to comment.