require 'formula' class NoGcrypt < Requirement satisfy(:build_env => false) { !Formula.factory("libgcrypt").installed? } def message; <<-EOS.undent This software can fail to compile when libgcrypt is installed. You may need to try: brew unlink libgcrypt brew install libmtp brew link libgcrypt EOS end end class Libmtp < Formula homepage 'http://libmtp.sourceforge.net/' url 'http://downloads.sourceforge.net/project/libmtp/libmtp/1.1.6/libmtp-1.1.6.tar.gz' sha1 'f9e55c75399fc5f4deabcdfa58e1b01b2e6e3283' depends_on NoGcrypt depends_on "pkg-config" => :build depends_on "libusb-compat" def install system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}" system "make install" end end ue='g3_v1_0'>g3_v1_0
aboutsummaryrefslogtreecommitdiffstats
path: root/test/widgetsSpec.js
blob: 44a3d22511b5fa0ac9da51329bebdc9aadb67f42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
describe("input widget", function(){

  var compile, element, scope, model;

  beforeEach(function() {
    scope = null;
    element = null;
    var compiler = new Compiler(angularTextMarkup, angularAttrMarkup, angularDirective, angularWidget);
    compile = function(html) {
      element = jqLite(html);
      var view = compiler.compile(element)(element);
      view.init();
      scope = view.scope;
      model = scope.state;
    };
  });

  afterEach(function(){
    if (element) element.remove();
    expect(_(jqCache).size()).toEqual(0);
  });

  it('should input-text auto init and handle keyup/change events', function(){
    compile('<input type="Text" name="name" value="Misko" ng-action="count = count + 1" ng-init="count=0"/>');
    expect(scope.get('name')).toEqual("Misko");
    expect(scope.get('count')).toEqual(0);

    scope.set('name', 'Adam');
    scope.updateView();
    expect(element.val()).toEqual("Adam");

    element.val('Shyam');
    element.trigger('keyup');
    expect(scope.get('name')).toEqual('Shyam');
    expect(scope.get('count')).toEqual(1);

    element.val('Kai');
    element.trigger('change');
    expect(scope.get('name')).toEqual('Kai');
    expect(scope.get('count')).toEqual(2);
  });

  it("should process ng-format", function(){
    compile('<input type="Text" name="list" value="a,b,c" ng-format="list"/>');
    expect(scope.get('list')).toEqual(['a', 'b', 'c']);

    scope.set('list', ['x', 'y', 'z']);
    scope.updateView();
    expect(element.val()).toEqual("x, y, z");

    element.val('1, 2, 3');
    element.trigger('keyup');
    expect(scope.get('list')).toEqual(['1', '2', '3']);
  });

  it("should process ng-validation", function(){
    compile('<input type="text" name="price" value="abc" ng-validate="number"/>');
    expect(element.hasClass('ng-validation-error')).toBeTruthy();
    expect(element.attr('ng-error')).toEqual('Not a number');

    scope.set('price', '123');
    scope.updateView();
    expect(element.hasClass('ng-validation-error')).toBeFalsy();
    expect(element.attr('ng-error')).toBeFalsy();

    element.val('x');
    element.trigger('keyup');
    expect(element.hasClass('ng-validation-error')).toBeTruthy();
    expect(element.attr('ng-error')).toEqual('Not a number');
  });

  it("should process ng-required", function(){
    compile('<input type="text" name="price" ng-required/>');
    expect(element.hasClass('ng-validation-error')).toBeTruthy();
    expect(element.attr('ng-error')).toEqual('Required');

    scope.set('price', 'xxx');
    scope.updateView();
    expect(element.hasClass('ng-validation-error')).toBeFalsy();
    expect(element.attr('ng-error')).toBeFalsy();

    element.val('');
    element.trigger('keyup');
    expect(element.hasClass('ng-validation-error')).toBeTruthy();
    expect(element.attr('ng-error')).toEqual('Required');
  });

  it("should process ng-required", function() {
    compile('<textarea name="name">Misko</textarea>');
    expect(scope.get('name')).toEqual("Misko");

    scope.set('name', 'Adam');
    scope.updateView();
    expect(element.val()).toEqual("Adam");

    element.val('Shyam');
    element.trigger('keyup');
    expect(scope.get('name')).toEqual('Shyam');

    element.val('Kai');
    element.trigger('change');
    expect(scope.get('name')).toEqual('Kai');
  });

  it('should call ng-action on button click', function(){
    compile('<input type="button" value="Click Me" ng-action="clicked = true"/>');
    element.click();
    expect(scope.get('clicked')).toEqual(true);
  });

  it('should type="checkbox"', function(){
    compile('<input type="checkbox" name="checkbox" checked ng-action="action = true"/>');
    expect(scope.get('checkbox')).toEqual(true);
    element.click();
    expect(scope.get('checkbox')).toEqual(false);
    expect(scope.get('action')).toEqual(true);
    element.click();
    expect(scope.get('checkbox')).toEqual(true);
  });

  it('should type="radio"', function(){
    compile('<div>' +
        '<input type="radio" name="chose" value="A" ng-action="clicked = 1"/>' +
        '<input type="radio" name="chose" value="B" checked ng-action="clicked = 2"/>' +
      '</div>');
    var a = element[0].childNodes[0];
    var b = element[0].childNodes[1];
    expect(model.chose).toEqual('B');
    expect(model.clicked).not.toBeDefined();
    model.chose = 'A';
    model.$updateView();
    expect(a.checked).toEqual(true);

    model.chose = 'B';
    model.$updateView();
    expect(a.checked).toEqual(false);
    expect(b.checked).toEqual(true);
    expect(model.clicked).not.toBeDefined();

    jqLite(a).click();
    expect(model.chose).toEqual('A');
    expect(model.clicked).toEqual(1);
  });

  it('should report error on missing field', function(){

  });

  it('should report error on assignment error', function(){

  });

  it('should report error on ng-action exception', function(){

  });


});