Ren­der­ing meth­ods used in En­zyme

Web Designer - - Developer Tutorials -

There are three dif­fer­ent types of ren­der­ing meth­ods that En­zyme can per­form – ‘shal­low’, ‘full’ and ‘static’. The case un­der test will de­ter­mine which method to use.

‘Shal­low’ ren­der­ing is the most com­mon and will limit the ren­der­ing to just the com­po­nent un­der test rather than any of its chil­dren. This means any er­rors caused when ren­der­ing those chil­dren will not fail the test.

‘Full’ ren­der­ing will ren­der ev­ery­thing from the par­ent down­wards. This can be par­tic­u­larly use­ful for test­ing those wrapped in higher or­der com­po­nents. Th­ese tests can take longer to run, but any com­po­nent do­ing any di­rect ma­nip­u­la­tion of the DOM will need to do a full ren­der.

‘Static’ ren­der­ing will only ren­der the com­po­nent once as static HTML. It can be faster but will not pro­vide any in­ter­ac­tion.

Newspapers in English

Newspapers from UK

© PressReader. All rights reserved.