~caneypuggies/reformedchurcheslocator/couchapp-backbone

« back to all changes in this revision

Viewing changes to _attachments/js/vendor/requirejs/tests/text/textBuilt.js

  • Committer: Tim Black
  • Date: 2013-09-16 22:50:16 UTC
  • Revision ID: tim@alwaysreformed.com-20130916225016-zk8jiba25z33ew7h
Versioned Bower vendor directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(function () {
 
2
    define('text',[],function () {
 
3
        var text = {
 
4
            load: function (name, req, onLoad, config) {
 
5
                throw "THE TEXT PLUGIN LOAD() FUNCTION SHOULD NOT BE CALLED";
 
6
            }
 
7
        };
 
8
 
 
9
        return text;
 
10
    });
 
11
}());
 
12
define('text!subwidget.html!strip', function () { return '<div data-type="subwidget"><h1>This is a subwidget</h1></div>';});
 
13
define('text!subwidget2.html', function () { return '<span>This! is template2</span>';});
 
14
 
 
15
define("subwidget",
 
16
  ["text!subwidget.html!strip", "text!subwidget2.html"],
 
17
  function(template, template2) {
 
18
    return {
 
19
      name: "subwidget",
 
20
      template: template,
 
21
      template2: template2
 
22
    };
 
23
  }
 
24
);
 
25
define('text!widget.html', function () { return '<div data-type="widget"><h1>This is a widget!</h1><p>I am in a widget</p></div>';});
 
26
 
 
27
define("widget",
 
28
  ["subwidget", "text!widget.html"],
 
29
  function(subwidget, template) {
 
30
    return {
 
31
      subWidgetName: subwidget.name,
 
32
      subWidgetTemplate: subwidget.template,
 
33
      subWidgetTemplate2: subwidget.template2,
 
34
      template: template
 
35
    };
 
36
  }
 
37
);
 
38
 
 
39
/****************** TEST CODE IS BELOW ******************/
 
40
 
 
41
require({
 
42
    baseUrl: "./",
 
43
    paths: {
 
44
        text: "../../../text/text"
 
45
    }
 
46
});
 
47
require(
 
48
    ["widget"],
 
49
    function(widget) {
 
50
        doh.register(
 
51
            "text",
 
52
            [
 
53
                function text(t){
 
54
                    t.is('<div data-type="widget"><h1>This is a widget!</h1><p>I am in a widget</p></div>', widget.template);
 
55
                    t.is('subwidget', widget.subWidgetName);
 
56
                    t.is('<div data-type="subwidget"><h1>This is a subwidget</h1></div>', widget.subWidgetTemplate);
 
57
                    t.is('<span>This! is template2</span>', widget.subWidgetTemplate2);
 
58
                }
 
59
            ]
 
60
        );
 
61
        doh.run();
 
62
 
 
63
    }
 
64
);