<commit_before>'use strict';

beforeEach(function() {

  module('ui.router.tabs');
  module('ui.router');
  module('ui.bootstrap');

  module(function($stateProvider) {
    $stateProvider
      .state('menu', {
        url: '/menu'
      })
      .state('menu.route1', {
        url: '/route1'
      }).state('menu.route2', {
        url: '/route2'
      })
      .state('notabs', {
        url: '/notabs'
      });
  });

  this.sandbox = sinon.sandbox.create();
});

afterEach(function() {
  this.sandbox.restore();
});

describe('Directive : UI Router : Tabs', function() {

  var root_scope, isolate_scope, scope, directive_scope, view, element, state, sandbox, spy;
  var createView, get_current_state, get_current_params;
  var $ngView;
  var params = {};

  beforeEach(inject(function($rootScope, $state, $templateCache) {

    createView = function(html, scope) {
      element = angular.element(view);

      inject(function($compile) {
        $ngView = $compile(html)(scope);
      });

      scope.$digest();
      directive_scope = $ngView.isolateScope();

      return $ngView;
    };

    scope = $rootScope.$new();
    state = $state;

    root_scope = $rootScope;

    get_current_state = function() {
      return state.current.name;
    };

    get_current_params = function() {
      return state.params;
    };

    scope.tabConfiguration = [{
      heading: 'Heading 1A',
      route: 'menu.route1'
        }, {
      heading: 'Heading 1B',
      route: 'menu.route1',
      params: {
        a: 5
      }
        }, {
      heading: 'Heading 2',
      route: 'menu.route2',
      params: params
        }];

    view = '<tabs data="tabConfiguration" type="pills"></tabs>';
    sandbox = this.sandbox;
  }));

  var renderView = function() {
    $ngView = createView(view, scope);

    isolate_scope = $ngView.isolateScope();
    spy = sandbox.spy(state, 'go');
  };

  it('should define the tabs directive with isolated scope', function() {
    renderView();
    expect(directive_scope).toBeDefined();
  });

  it('should throw an error if no data attribute was specified', function() {
    renderView();

    expect(function() {
      createView('<tabs></tabs>', scope);
    }).toThrow('UI Router Tabs: \'data\' attribute not defined, please check documentation for how to use this directive.');
  });<commit_msg>Removed default route optiona from ui-router-tabs.<commit_after>'use strict';

beforeEach(function() {

  module('ui.router.tabs');
  module('ui.router');
  module('ui.bootstrap');

  module(function($stateProvider) {
    $stateProvider
      .state('menu', {
        url: '/menu'
      })
      .state('menu.route1', {
        url: '/route1'
      }).state('menu.route2', {
        url: '/route2'
      })
      .state('notabs', {
        url: '/notabs'
      });
  });

  this.sandbox = sinon.sandbox.create();
});

afterEach(function() {
  this.sandbox.restore();
});

describe('Directive : UI Router : Tabs', function() {

  var root_scope, isolate_scope, scope, directive_scope, view, element, state, sandbox, spy;
  var createView, get_current_state, get_current_params;
  var $ngView;
  var params = {};

  beforeEach(inject(function($rootScope, $state, $templateCache) {

    createView = function(html, scope) {
      element = angular.element(view);

      inject(function($compile) {
        $ngView = $compile(html)(scope);
      });

      scope.$digest();
      directive_scope = $ngView.isolateScope();

      return $ngView;
    };

    scope = $rootScope.$new();
    state = $state;

    root_scope = $rootScope;

    get_current_state = function() {
      return state.current.name;
    };

    get_current_params = function() {
      return state.params;
    };

    scope.tabConfiguration = [{
      heading: 'Heading 1A',
      route: 'menu.route1'
    }, {
      heading: 'Heading 1B',
      route: 'menu.route1',
      params: {
        a: 5
      }
    }, {
      heading: 'Heading 2',
      route: 'menu.route2',
      params: params
    }];

    view = '<tabs data="tabConfiguration" type="pills"></tabs>';
    sandbox = this.sandbox;
  }));

  var renderView = function() {
    $ngView = createView(view, scope);

    isolate_scope = $ngView.isolateScope();
    spy = sandbox.spy(state, 'go');
  };

  it('should define the tabs directive with isolated scope', function() {
    renderView();
    expect(directive_scope).toBeDefined();
  });

  it('should throw an error if no data attribute was specified', function() {
    renderView();

    expect(function() {
      createView('<tabs></tabs>', scope);
    }).toThrow('UI Router Tabs: \'data\' attribute not defined, please check documentation for how to use this directive.');
  });
{'fraction_non_alphanumeric': 0.15939561608852948, 'fraction_numerical': 0.004681847201532241, 'mean_word_length': 2.7811745776347547, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5739693', 'n_tokens_mistral': 1516, 'n_tokens_neox': 1451, 'n_words': 319}