describe('Semantic-UI: Elements - smCheckbox', function() {
  'use strict';

  var $scope, $compile, $rootScope;

  beforeEach(module('semantic.ui.elements.checkbox'));

  beforeEach(inject(function(_$rootScope_, _$compile_) {
    $rootScope = _$rootScope_;
    $scope = $rootScope.$new();
    $compile = _$compile_;
  }));

  it('should transclude the text content', function() {
    var smCheckbox = $compile('<sm-checkbox ng-model="test">Checkbox</sm-checkbox>')($scope);
    $scope.$digest();
    expect(smCheckbox.text()).toBe('Checkbox');
  });

  it('should support custom aria-label arribute', function() {
    var smCheckbox = $compile('<sm-checkbox aria-label="my lame checkbox" ng-model="opts.checked">Checkbox</sm-checkbox>')($scope);

    $scope.$digest();

    expect(smCheckbox.attr('aria-label')).toBe('my lame checkbox');
  });

  it('should support fallback aria-label arribute', function() {
    var smCheckbox = $compile('<sm-checkbox ng-model="opts.checked">Checkbox</sm-checkbox>')($scope);

    $scope.$digest();

    expect(smCheckbox.attr('aria-label')).toBe('Checkbox');
  });

  it('should support the \'toggle\' attribute', function() {
    var smCheckbox = $compile('<sm-checkbox toggle ng-model="opts.checked">Checkbox</sm-checkbox>')($scope);

    $scope.$digest();

    expect(angular.element(smCheckbox[0]).hasClass('toggle')).toBeTruthy();
  });

  it('should support the \'slider\' attribute', function() {
    var smCheckbox = $compile('<sm-checkbox slider ng-model="opts.checked">Checkbox</sm-checkbox>')($scope);

    $scope.$digest();

    expect(angular.element(smCheckbox[0]).hasClass('slider')).toBeTruthy();
  });

  it('should honour ng-disabled', function() {
    var $newScope = $rootScope.$new();

    $newScope.opts = { 
      checked: true,
      disabled: false
    };

    var smCheckbox = $compile(
      '<sm-checkbox ng-model="opts.checked" ng-disabled="opts.disabled">Checkbox</sm-checkbox>'
    )($newScope);

    $newScope.$digest();

    expect(smCheckbox[0].children[0].disabled).toBeFalsy();

    $newScope.opts.disabled = true;

    $newScope.$digest();

    // trigger a click
    angular.element(smCheckbox[0].children[0]).click();

    $newScope.$digest();

    // inner checkbox should be disabled
    expect(smCheckbox[0].children[0].disabled).toBeTruthy();

    // ...and thus still checked
    expect(smCheckbox[0].children[0].checked).toBeTruthy();

  });

  it('should honour ng-model', function() {
    var $newScope = $rootScope.$new();

    $newScope.opts = { 
      checked: false
    };

    var smCheckbox = $compile('<sm-checkbox ng-model="opts.checked">Checkbox</sm-checkbox>')($newScope);
    $newScope.$digest();

    expect(smCheckbox[0].children[0].checked).toBeFalsy();

    $newScope.opts.checked = true;
    $newScope.$digest();

    expect(smCheckbox[0].children[0].checked).toBeTruthy();
  });

  it('should write \'checked\' change back to scope', function() {
    var $newScope = $rootScope.$new();
    $newScope.opts = { checked: false };
    var smCheckbox = $compile('<sm-checkbox ng-model="opts.checked">Checkbox</sm-checkbox>')($newScope);
    $newScope.$digest();

    expect(smCheckbox[0].children[0].checked).toBeFalsy();

    angular.element(smCheckbox[0]).click();

    $newScope.$digest();

    expect($newScope.opts.checked).toBeTruthy();
  });
});

@@ -682,16 +682,27 @@
 eckbox%22 
+' +%0A      '
 ng-model
@@ -3350,12 +3350,958 @@
 ;%0A  %7D);%0A
+%0A  it('should tranclude a transclusion directive', function() %7B%0A    var $newScope = $rootScope.$new();%0A    %0A    $newScope.opts = %7B checked: true %7D;%0A    %0A    var smCheckbox = $compile('%3Csm-checkbox ng-model=%22opts.checked%22%3E' +%0A      '%3Cdiv ng-if=%22opts.checked%22%3EChecked%3C/div%3E%3C/sm-checkbox%3E')($newScope);%0A%0A    $newScope.$digest();%0A%0A    expect(smCheckbox.find('label').find('div').length).toBe(1);%0A  %7D);%0A%0A  it('should honour ng-repeat', function() %7B%0A    var $newScope = $rootScope.$new();%0A    %0A    $newScope.opts = %7B checked: true %7D;%0A    $newScope.repeatLabels = %5B'first', 'second'%5D;%0A    %0A    var smCheckbox = $compile('%3Cdiv%3E%3Csm-checkbox ng-repeat=%22label in repeatLabels%22 ng-model=%22opts.checked%22%3E' +%0A      '%3Cdiv ng-if=%22opts.checked%22%3E%7B%7Blabel%7D%7D%3C/div%3E%3C/sm-checkbox%3E%3C/div%3E')($newScope);%0A%0A    $newScope.$digest();%0A%0A    expect(smCheckbox.find('label')%5B0%5D.textContent).toBe('first');%0A    expect(smCheckbox.find('label')%5B1%5D.textContent).toBe('second');%0A  %7D);%0A%0A
 %7D);%0A

Add transclusion directive content test and `ng-repeat` test