github.com/MontFerret/ferret@v0.18.0/pkg/drivers/cdp/dom/helpers_test.go (about)

     1  package dom
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/smartystreets/goconvey/convey"
     7  )
     8  
     9  func Test_toCamelCase(t *testing.T) {
    10  	Convey("toCamelCase", t, func() {
    11  		Convey("should format string into camel case", func() {
    12  			inputs := []struct {
    13  				actual   string
    14  				expected string
    15  			}{
    16  				{
    17  					actual:   "foo-bar",
    18  					expected: "fooBar",
    19  				},
    20  				{
    21  					actual:   "foo-1-bar",
    22  					expected: "foo1Bar",
    23  				},
    24  				{
    25  					actual:   "overscroll-behavior-x",
    26  					expected: "overscrollBehaviorX",
    27  				},
    28  				{
    29  					actual:   "x",
    30  					expected: "x",
    31  				},
    32  				{
    33  					actual:   "foo-x",
    34  					expected: "fooX",
    35  				},
    36  				{
    37  					actual:   "foo-$",
    38  					expected: "foo",
    39  				},
    40  				{
    41  					actual:   "color",
    42  					expected: "color",
    43  				},
    44  				{
    45  					actual:   "textDecorationSkipInk",
    46  					expected: "textDecorationSkipInk",
    47  				},
    48  			}
    49  
    50  			for _, input := range inputs {
    51  				So(toCamelCase(input.actual), ShouldEqual, input.expected)
    52  			}
    53  		})
    54  	})
    55  }