angular/angular-hint

View on GitHub
e2e/hint.spec.js

Summary

Maintainability
A
0 mins
Test Coverage
'use strict';

var consoleText = require('./util.protractor');

describe('angularHint', function() {
  it('should include all modules by ng-hint default', function() {
    browser.get('all-hint/');

    //angular-hint-controllers
    expect(consoleText()).toContain('The best practice is to name ' +
      'controllers ending with \'Controller\'. Check the name of \'Hint\'');

    //angular-hint-directives
    expect(consoleText()).toContain('ng-repeat');

    //angular-hint-dom
    //expect(consoleText()).toContain('getElementById');

    //angular-hint-events
    //expect(consoleText()).toContain('Variable "increment" called on DIV ' +
    // 'element does not exist in that scope.');

    //angular-hint-interpolation
    //expect(consoleText()).toContain('was found to be undefined in');

    //angular-hint-modules
    expect(consoleText()).toContain('Angular Hint: Modules; ' +
        'Error; ' +
        'ng-app may only be included once. The module "sampleAllHint" was not used to bootstrap because ng-app was already included.;');
  });


  it('should have an inclusive mode', function() {
    browser.get('inclusive-hint/');
    //expect(consoleText())
    //  .toContain('getElementById');
  });

  // TODO: fix this assertion
  it('should have an exclusive mode', function() {
    browser.get('exclusive-hint/');
    //expect(consoleText()).toContain('getElementById');
    // expect(consoleText()).toContain('Variable "increment" called on DIV ' +
    //   'element does not exist in that scope.');
    expect(consoleText()).not.toContain('ng-repeat');
  });


  it('should warn if there is no ng-hint attribute', function() {
    browser.get('no-hint/');
    expect(consoleText())
      .toBe('Angular Hint: General; Warning; ngHint is included on the page, but is not active because there is no `ng-hint` attribute present;');
  });
});