@@ -3,14 +3,16 @@ import {
3
3
expectSingleUndo2Saves ,
4
4
hoverControlWithCheck ,
5
5
selectComponentsForTest ,
6
+ setFeatureForBrowserTestsUseInDescribeBlockOnly ,
6
7
} from '../../utils/utils.test-utils'
7
8
import { CanvasControlsContainerID } from '../canvas/controls/new-canvas-controls'
8
9
import { getSubduedPaddingControlTestID } from '../canvas/controls/select-mode/subdued-padding-control'
9
10
import { mouseClickAtPoint } from '../canvas/event-helpers.test-utils'
10
11
import type { EditorRenderResult } from '../canvas/ui-jsx.test-utils'
11
- import { renderTestEditorWithCode } from '../canvas/ui-jsx.test-utils'
12
+ import { renderTestEditorWithCode , renderTestEditorWithModel } from '../canvas/ui-jsx.test-utils'
12
13
import type { FlexDirection } from './common/css-utils'
13
14
import { FlexDirectionControlTestId , FlexDirectionToggleTestId } from './flex-direction-control'
15
+ import { TailwindProject } from './sections/flex-section.test-utils'
14
16
15
17
describe ( 'set flex direction' , ( ) => {
16
18
it ( 'set flex direction to row from not set' , async ( ) => {
@@ -111,6 +113,62 @@ describe('set flex direction', () => {
111
113
expect ( controls . length ) . toEqual ( 4 )
112
114
} )
113
115
} )
116
+
117
+ describe ( 'Tailwind' , ( ) => {
118
+ setFeatureForBrowserTestsUseInDescribeBlockOnly ( 'Tailwind' , true )
119
+
120
+ it ( 'set flex direction to column from not set' , async ( ) => {
121
+ const editor = await renderTestEditorWithModel (
122
+ TailwindProject ( 'flex' ) ,
123
+ 'await-first-dom-report' ,
124
+ )
125
+ await selectDiv ( editor )
126
+ await expectSingleUndo2Saves ( editor , ( ) => clickOn ( editor , 'column' ) )
127
+ const div = editor . renderedDOM . getByTestId ( 'mydiv' )
128
+ expect ( div . className ) . toEqual (
129
+ 'top-10 left-10 w-64 h-64 bg-slate-100 absolute flex flex-col' , // flex-col is set by the control
130
+ )
131
+ } )
132
+
133
+ it ( 'set flex direction to row-reverse from not set' , async ( ) => {
134
+ const editor = await renderTestEditorWithModel (
135
+ TailwindProject ( 'flex' ) ,
136
+ 'await-first-dom-report' ,
137
+ )
138
+ await selectDiv ( editor )
139
+ await expectSingleUndo2Saves ( editor , ( ) => clickOn ( editor , 'row-reverse' ) )
140
+ const div = editor . renderedDOM . getByTestId ( 'mydiv' )
141
+ expect ( div . className ) . toEqual (
142
+ 'top-10 left-10 w-64 h-64 bg-slate-100 absolute flex flex-row-reverse' , // flex-row-reverse is set by the control
143
+ )
144
+ } )
145
+
146
+ it ( 'set flex direction to column-reverse from not set' , async ( ) => {
147
+ const editor = await renderTestEditorWithModel (
148
+ TailwindProject ( 'flex' ) ,
149
+ 'await-first-dom-report' ,
150
+ )
151
+ await selectDiv ( editor )
152
+ await expectSingleUndo2Saves ( editor , ( ) => clickOn ( editor , 'column-reverse' ) )
153
+ const div = editor . renderedDOM . getByTestId ( 'mydiv' )
154
+ expect ( div . className ) . toEqual (
155
+ 'top-10 left-10 w-64 h-64 bg-slate-100 absolute flex flex-col-reverse' , // flex-row-reverse is set by the control
156
+ )
157
+ } )
158
+
159
+ it ( 'set flex direction to row from column' , async ( ) => {
160
+ const editor = await renderTestEditorWithModel (
161
+ TailwindProject ( 'flex flex-col' ) ,
162
+ 'await-first-dom-report' ,
163
+ )
164
+ await selectDiv ( editor )
165
+ await expectSingleUndo2Saves ( editor , ( ) => clickOn ( editor , 'row' ) )
166
+ const div = editor . renderedDOM . getByTestId ( 'mydiv' )
167
+ expect ( div . className ) . toEqual (
168
+ 'top-10 left-10 w-64 h-64 bg-slate-100 absolute flex flex-row' , // flex-row is set by the control
169
+ )
170
+ } )
171
+ } )
114
172
} )
115
173
116
174
async function selectDiv ( editor : EditorRenderResult ) : Promise < HTMLElement > {
0 commit comments