js.yui basic tests
==================

Here are some basic tests for js.yui.

Let's check the YUI structure by picking out a resource in it::

  >>> import js.yui
  >>> from fanstatic import init_needed
  >>> needed = init_needed(base_url='http://localhost')
  >>> needed.need(js.yui.fonts)
  >>> print needed.render()
  <link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/fonts/fonts.css" />

Let's try a resource that has a dependency on fonts, namely
``grids``::

  >>> needed = init_needed(base_url='http://localhost')
  >>> needed.need(js.yui.grids)
  >>> print needed.render()
  <link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/fonts/fonts.css" />
  <link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/grids/grids.css" />

Let's need two resources at the same time::

  >>> needed = init_needed(base_url='http://localhost')
  >>> needed.need(js.yui.grids)
  >>> needed.need(js.yui.reset)
  >>> print needed.render()
  <link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/fonts/fonts.css" />
  <link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/grids/grids.css" />
  <link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/reset/reset.css" />

Let's get the same, minified::

  >>> needed = init_needed(base_url='http://localhost', mode='minified')
  >>> needed.need(js.yui.grids)
  >>> needed.need(js.yui.reset)
  >>> print needed.render()
  <link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/fonts/fonts-min.css" />
  <link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/grids/grids-min.css" />
  <link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/reset/reset-min.css" />

Now let's try to see consolidation: we include grids and reset at the
same time. Since this time we enable rolling up, we expect to see the
rollup ``reset-fonts-grids``::

  >>> needed = init_needed(
  ...     base_url='http://localhost', rollup=True)
  >>> needed.need(js.yui.grids)
  >>> needed.need(js.yui.reset)
  >>> print needed.render()
  <link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/reset-fonts-grids/reset-fonts-grids.css" />

Requesting minification has no effect on rollups, as the original
rollup is already minified::

  >>> needed = init_needed(
  ...     base_url='http://localhost', rollup=True, mode='minified')
  >>> needed.need(js.yui.grids)
  >>> needed.need(js.yui.reset)
  >>> print needed.render()
  <link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/reset-fonts-grids/reset-fonts-grids.css" />

