File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed
Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -71,8 +71,8 @@ class Video extends CloudinaryComponent {
7171 const snakeCaseOptions = Util . withSnakeCaseKeys ( options ) ;
7272 const cld = Cloudinary . new ( snakeCaseOptions ) ;
7373
74- // Let cloudinary-core handle genrating this video tag attributes
75- const tagAttributes = cld . videoTag ( publicId , snakeCaseOptions ) . attributes ( ) ;
74+ // Let cloudinary-core generate this video tag attributes
75+ const tagAttributes = Util . withCamelCaseKeys ( cld . videoTag ( publicId , options ) . attributes ( ) ) ;
7676
7777 // Aggregate child transformations, used for generating <source> tags for this video element
7878 const childTransformations = this . getTransformation ( { ...options , children} ) ;
Original file line number Diff line number Diff line change @@ -166,4 +166,29 @@ describe('Video', () => {
166166
167167 expect ( tag . props ( ) . poster ) . to . equal ( 'http://res.cloudinary.com/demo/video/upload/c_scale,w_100/dpr_2.0/elephants.jpg' ) ;
168168 } ) ;
169+ it ( 'Should pass camelCase attributes to Video component' , function ( ) {
170+ const tag = shallow (
171+ < Video playsInline autoPlay cloudName = 'demo' publicId = 'dog' />
172+ ) ;
173+
174+ const { autoPlay, auto_play, playsInline, plays_inline} = tag . props ( ) ;
175+
176+ expect ( playsInline ) . to . equal ( true ) ;
177+ expect ( autoPlay ) . to . equal ( true ) ;
178+
179+ expect ( plays_inline ) . to . equal ( undefined ) ;
180+ expect ( auto_play ) . to . equal ( undefined ) ;
181+ } ) ;
182+ it ( 'Should pass camelCase attributes to inner video element' , function ( ) {
183+ let tag = mount (
184+ < Video playsInline autoPlay cloudName = 'demo' publicId = 'dog' />
185+ ) ;
186+
187+ const video = tag . find ( 'video' ) ;
188+ expect ( video . prop ( 'playsInline' ) ) . to . equal ( true ) ;
189+ expect ( video . prop ( 'autoPlay' ) ) . to . equal ( true ) ;
190+
191+ expect ( video . prop ( 'plays_inline' ) ) . to . equal ( undefined ) ;
192+ expect ( video . prop ( 'auto_play' ) ) . to . equal ( undefined ) ;
193+ } ) ;
169194} ) ;
You can’t perform that action at this time.
0 commit comments