[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/webroot/rsrc/externals/javelin/ext/view/__tests__/ -> ViewInterpreter.js (source)

   1  /**
   2   * @requires javelin-view
   3   *           javelin-view-interpreter
   4   *           javelin-view-html
   5   *           javelin-util
   6   */
   7  
   8  describe('JX.ViewInterpreter', function() {
   9    var html = new JX.ViewInterpreter();
  10  
  11    JX.HTMLView.registerToInterpreter(html);
  12  
  13    it('should allow purty syntax to make a view', function() {
  14      var little_view =
  15      html.div({},
  16        html.p({className: 'pretty'},
  17          html.span({sigil: 'hook'},
  18            'Check out ',
  19            html.a({href: 'https://fb.com/', rel: '_blank' }, 'Facebook'))));
  20  
  21      var rendered = JX.ViewRenderer.render(little_view);
  22  
  23      expect(rendered.tagName).toBe('DIV');
  24      expect(JX.DOM.scry(rendered, 'span', 'hook').length).toBe(1);
  25    });
  26  
  27    it('should handle no-attr case', function() {
  28      /* Coffeescript:
  29       *     div(
  30       *       span className: 'some-css-class', ref: 'actorTargetLine'
  31       *       span className: 'message-css', ref: 'message'
  32       *     )
  33       *
  34       * = javascript:
  35       * div(span({
  36       *   className: 'some-css-class',
  37       *   ref: 'actorTargetLine'
  38       * }), span({
  39       *  className: 'message-css',
  40       *  ref: 'message'
  41       * }));
  42       */
  43      var little_view = html.div(html.span({sigil: 'hook'}));
  44      var rendered = JX.ViewRenderer.render(little_view);
  45      expect(JX.DOM.scry(rendered, 'span', 'hook').length).toBe(1);
  46    });
  47  });


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1