Ejemplo n.º 1
0
import { test , moduleForComponent } from 'appkit/tests/helpers/module_for';
import MailToComponent from 'appkit/components/mail-to';

var component;

moduleForComponent('mail-to', 'Unit - Mail to component', 
                   {
  setup: function() {
    component = this.subject();
  }
});

test('href', function() {
  component = MailToComponent.create({
      email: '*****@*****.**'
  });

    equal(component.get('href'),
    'mailto:test@example.com');
});
import { test , moduleForComponent } from 'appkit/tests/helpers/module_for';

moduleForComponent('template-less');

test("template", function(){
  var component = this.subject();
  ok(this.$());
});
Ejemplo n.º 3
0
import { test , moduleForComponent } from 'appkit/tests/helpers/module_for';

moduleForComponent('edit-todo');

test("asdf", function(){
  ok(this.subject() instanceof Ember.Component);
  ok(this.$().is('input'), 'is an input');
  ok(this.$().is('.focus'), 'is in focus');
});
Ejemplo n.º 4
0
import { test , moduleForComponent } from 'appkit/tests/helpers/module_for';

moduleForComponent('pretty-color');

test("changing colors", function(){
  var component = this.subject();

  Ember.run(function(){
    component.set('name','red');
  });

  // first call to $() renders the component.
  equal(this.$().attr('style'), 'color: red;');

  Ember.run(function(){
    component.set('name', 'green');
  });

  equal(this.$().attr('style'), 'color: green;');
});


test("className", function(){
  // first call to this.$() renders the component.
  ok(this.$().is('.pretty-color'));
});
Ejemplo n.º 5
0
import { test , moduleForComponent } from 'appkit/tests/helpers/module_for';
import GravatarImageComponent from 'appkit/components/gravatar-image';

var component;

moduleForComponent('gravatar-image', 'Unit - Gravatar image component', 
                   {
  setup: function() {
    component = this.subject();
  }
});

test('src with valid email', function() {
  component = GravatarImageComponent.create({
      email: '*****@*****.**'
  });

    equal(component.get('src'),
    'http://www.gravatar.com/avatar/e4f7cd8905e896b04425b1d08411e9fb.jpg?s=80');
});

test('src with blank email', function() {
    component = GravatarImageComponent.create({
        email: ''
    });

    equal(component.get('src'),
    'http://www.gravatar.com/avatar/00000000000000000000000000000000.jpg?s=80');

});