C
C
copal2016-02-28 21:47:47
JavaScript
copal, 2016-02-28 21:47:47

How to resolve the situation with object state changes in the describe block?

There is a block of code in describe in jasmine that creates an HTMLElement, sets its dimensions and passes it to an object, where, based on the data received from this element, a calculation is performed. But now I need to resize the element again and repeat everything again. But naturally, everything does not work, since the code is executed first, and then the tests. I know about done, with which you can create a chain, but tests. And how to make a chain of initialization of states for an element? For example, beforeEach executes the code before the start of the tests, and afterEach, after. But how to make it so that there was ...beforeEach...one test....again, but already another beforeEach .... already another test.. Is it possible to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey P, 2016-02-29
@ruddy22

What's the problem with doing this?
1. Create a global object and change its properties in each describe block
2. Create a constructor to create this element and call this constructor in the desired test to get the element.
3. Use cascading nesting of describe blocks. Create an element in the root, and change it in each child.
What is the question, what is the answer.
Your question is too general without a code example. Difficult to advise

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question