ftlabs / fruitmachine

View rendering engine
MIT License
247 stars 18 forks source link

Write some tests for inflating server rendered views #11

Closed wilsonpage closed 11 years ago

matthew-andrews commented 11 years ago

Do you still need someone to do this? I'm about to start playing around server side fruitmachine for tutorial-5.

wilsonpage commented 11 years ago

Functionality is proven working by examples/express. But we do still need testing writing for the inflation of views.

Two things need to be tested:

Handling models that have come embedded in the View is slightly more complicated. I have proposed that if/when a model is found on the view module being constructed, we fire and event or call a defined function so that the developer has the opportunity to swap out the stale display only model with a real client-side model (eg. from indexedDB). The view then get re-associated with a different model, so that when/if the view is re-rendered then the data is extracted from the correctly decoupled model.

wilsonpage commented 11 years ago

Why is the formatting so shit above?

wilsonpage commented 11 years ago

I have some basic test for .toJSON() but these still need to be expanded.

We need a rather more complex test as follows:

  1. Render a view and put it in the DOM.
  2. Call .toJSON() to get the JSON representation of the view.
  3. Pass the json into fruitmachine var layout = fruitmachine(json);
  4. Call layout.setup();
  5. Expect the layout.el to match the original element.
wilsonpage commented 11 years ago

This has been done