"use strict" ; import { Linter , Rule } from 'template-lint' ; import { Config } from '../source/config' ; import { AureliaLinter } from '../source/aurelia-linter' ; import { BindingRule } from '../source/rules/binding' ; import { Reflection } from '../source/reflection' ; import { initialize } from 'aurelia-pal-nodejs' ; initialize ( ) ; describe ( "ID Attribute Rule" , ( ) => { it ( "will reject empty id" , ( done ) => { var config = new Config ( ) ; var linter = new AureliaLinter ( config ) ; var html = `
    <template>
       <div id=""></div>
    </template>` ; linter . lint ( html ) . then ( ( issues ) => { try { expect ( issues . length ) . toBe ( 1 ) ; } catch ( err ) { fail ( err ) ; } finally { done ( ) ; } } ) ; } ) ; it ( "will reject bad id" , ( done ) => { var config = new Config ( ) ; var linter = new AureliaLinter ( config ) ; var html = `
    <template>
       <div id="£"></div>
    </template>` ; linter . lint ( html ) . then ( ( issues ) => { try { expect ( issues . length ) . toBe ( 1 ) ; } catch ( err ) { fail ( err ) ; } finally { done ( ) ; } } ) ; } ) ; it ( "will allow interpolated (aurelia) id" , ( done ) => { var config = new Config ( ) ; var linter = new AureliaLinter ( config ) ; var html = `
    <template>
       <div id="\${boo}"></div>
    </template>` ; linter . lint ( html ) . then ( ( issues ) => { try { expect ( issues . length ) . toBe ( 0 ) ; } catch ( err ) { fail ( err ) ; } finally { done ( ) ; } } ) ; } ) ; it ( "will reject duplicated id" , ( done ) => { var config = new Config ( ) ; var linter = new AureliaLinter ( config ) ; var html = `
    <template>
       <div id="boo"></div>
       <div id="boo"></div>
    </template>` ; linter . lint ( html ) . then ( ( issues ) => { try { expect ( issues . length ) . toBe ( 1 ) ; } catch ( err ) { fail ( err ) ; } finally { done ( ) ; } } ) ; } ) ; it ( "will allow duplicate interpolated id" , ( done ) => { var config = new Config ( ) ; var linter = new AureliaLinter ( config ) ; var html = `
    <template>
       <div id="\${boo}"></div>
       <div id="\${boo}"></div>
    </template>` ; linter . lint ( html ) . then ( ( issues ) => { try { expect ( issues . length ) . toBe ( 0 ) ; } catch ( err ) { fail ( err ) ; } finally { done ( ) ; } } ) ; } ) ; } ) ;