@@ -10,7 +10,11 @@ test('convert to sass', () => {
1010 @apply w-72 h-40 bg-green-400 transform transition-all;
1111}`
1212
13- const converterResult = convertToSass ( htmlCotnent )
13+ const converterConfigs = < ITwToSassOptions > {
14+ orderByTailwindClasses : false
15+ }
16+
17+ const converterResult = convertToSass ( htmlCotnent , converterConfigs )
1418
1519 expect ( converterResult ?. sass ) . toBe ( sassOutput )
1620} )
@@ -28,7 +32,11 @@ test('convert to sass with inline css', () => {
2832 font-weight: 50px;
2933}`
3034
31- const converterResult = convertToSass ( htmlCotnent )
35+ const converterConfigs = < ITwToSassOptions > {
36+ orderByTailwindClasses : false
37+ }
38+
39+ const converterResult = convertToSass ( htmlCotnent , converterConfigs )
3240
3341 expect ( converterResult ?. sass ) . toBe ( sassOutput )
3442} )
@@ -57,7 +65,9 @@ test('convert to sass with comments', () => {
5765 const converterConfigs = < ITwToSassOptions > {
5866 useCommentBlocksAsClassName : true ,
5967 printSassComments : true ,
68+ orderByTailwindClasses : false
6069 }
70+
6171 const converterResult = convertToSass ( htmlCotnent , converterConfigs )
6272
6373 expect ( converterResult ?. sass ) . toBe ( sassOutput )
@@ -87,6 +97,7 @@ test('convert to sass with comments class names', () => {
8797 const converterConfigs = < ITwToSassOptions > {
8898 useCommentBlocksAsClassName : true ,
8999 printSassComments : true ,
100+ orderByTailwindClasses : false ,
90101 classNameOptions : {
91102 lowercase : true ,
92103 replacement : '_' ,
@@ -127,7 +138,11 @@ test('convert to sass with group-modifier', () => {
127138 }
128139}`
129140
130- const converterResult = convertToSass ( htmlCotnent )
141+ const converterConfigs = < ITwToSassOptions > {
142+ orderByTailwindClasses : false
143+ }
144+
145+ const converterResult = convertToSass ( htmlCotnent , converterConfigs )
131146
132147 expect ( converterResult ?. sass ) . toBe ( sassOutput )
133148} )
@@ -175,8 +190,33 @@ test('convert to sass with non-duplicated classes', () => {
175190 }
176191}`
177192
178- const converterResult = convertToSass ( htmlCotnent )
193+ const converterConfigs = < ITwToSassOptions > {
194+ orderByTailwindClasses : false
195+ }
196+
197+ const converterResult = convertToSass ( htmlCotnent , converterConfigs )
179198
180199 expect ( converterResult ?. sass ) . toBe ( sassOutput )
181200} )
182201
202+ test ( 'convert to sass with class ordering' , ( ) => {
203+ const htmlCotnent = `<!-- My Button -->
204+ <button class="flex items-center justify-center w-full px-4 py-2 space-x-1 font-medium tracking-wider uppercase bg-gray-100 border rounded-md focus:outline-none focus:ring">
205+ test
206+ </button>`
207+
208+ const sassOutput = `/* My Button -> 1 */
209+ .my-button {
210+ @apply bg-gray-100 border flex focus:outline-none focus:ring font-medium items-center justify-center px-4 py-2 rounded-md space-x-1 tracking-wider uppercase w-full;
211+ }`
212+
213+ const converterConfigs = < ITwToSassOptions > {
214+ useCommentBlocksAsClassName : true ,
215+ printSassComments : true ,
216+ orderByTailwindClasses : true
217+ }
218+
219+ const converterResult = convertToSass ( htmlCotnent , converterConfigs )
220+
221+ expect ( converterResult ?. sass ) . toBe ( sassOutput )
222+ } )
0 commit comments