<commit_before>import { assert } from 'chai';
import { getTokenOnCharRange, hasScope, tokenizeLine } from './test.utils';

describe('The Aurelia HTML syntax invoke attributes', () => {

  it('must tokenize call attribute with scope "invoke.attribute.html.au"', () => {

    // arrange
    let scope = 'invoke.attribute.html.au';

    // act
    let lineToken = tokenizeLine('<div click.call="test()">');

    // assert
    let token = getTokenOnCharRange(lineToken, 11, 15);
    assert.isOk(hasScope(token.scopes, scope));

  });

  it('must tokenize triger attribute with scope "invoke.attribute.html.au"', () => {

    // arrange
    let scope = 'invoke.attribute.html.au';

    // act
    let lineToken = tokenizeLine('<div click.trigger="test()">');

    // assert
    let token = getTokenOnCharRange(lineToken, 11, 18);
    assert.isOk(hasScope(token.scopes, scope));

  });

  it('must tokenize delegate attribute with scope "invoke.attribute.html.au"', () => {

    // arrange
    let scope = 'invoke.attribute.html.au';

    // act
    let lineToken = tokenizeLine('<div click.delegate="test()">');

    // assert
    let token = getTokenOnCharRange(lineToken, 11, 19);
    assert.isOk(hasScope(token.scopes, scope));

  });

  it('must not tokenize invokes in attribute body with scope "invoke.attribute.html.au"', () => {

    // arrange
    let scope = 'meta.tag.inline.any.html';

    // act
    let lineToken = tokenizeLine('<a b="draw.call:animate(data)">');

    // assert
    let token = getTokenOnCharRange(lineToken, 6, 29);
    assert.isOk(hasScope(token.scopes, scope));

  });
   
});<commit_msg>test(syntax): don't tokenize trigger inside body of attributes<commit_after>import { assert } from 'chai';
import { getTokenOnCharRange, hasScope, tokenizeLine } from './test.utils';

describe('The Aurelia HTML syntax invoke attributes', () => {

  it('must tokenize call attribute with scope "invoke.attribute.html.au"', () => {

    // arrange
    let scope = 'invoke.attribute.html.au';

    // act
    let lineToken = tokenizeLine('<div click.call="test()">');

    // assert
    let token = getTokenOnCharRange(lineToken, 11, 15);
    assert.isOk(hasScope(token.scopes, scope));

  });

  it('must tokenize triger attribute with scope "invoke.attribute.html.au"', () => {

    // arrange
    let scope = 'invoke.attribute.html.au';

    // act
    let lineToken = tokenizeLine('<div click.trigger="test()">');

    // assert
    let token = getTokenOnCharRange(lineToken, 11, 18);
    assert.isOk(hasScope(token.scopes, scope));

  });

  it('must not tokenize attribute body that contains click.trigger keyword', () => {

    // arrange-
    let scope = 'meta.tag.block.any.html';

    // act
    let lineToken = tokenizeLine('<div value.bind="click.trigger">');

    // assert
    let token = getTokenOnCharRange(lineToken, 17, 30);
    assert.isOk(hasScope(token.scopes, scope));

  });  

  it('must not tokenize invokes in attribute body with scope "invoke.attribute.html.au"', () => {

    // arrange
    let scope = 'meta.tag.inline.any.html';

    // act
    let lineToken = tokenizeLine('<a b="draw.call:animate(data)">');

    // assert
    let token = getTokenOnCharRange(lineToken, 6, 29);
    assert.isOk(hasScope(token.scopes, scope));

  });  

  it('must tokenize delegate attribute with scope "invoke.attribute.html.au"', () => {

    // arrange
    let scope = 'invoke.attribute.html.au';

    // act
    let lineToken = tokenizeLine('<div click.delegate="test()">');

    // assert
    let token = getTokenOnCharRange(lineToken, 11, 19);
    assert.isOk(hasScope(token.scopes, scope));

  });

});
{'fraction_non_alphanumeric': 0.16135239142385926, 'fraction_numerical': 0.009345794392523364, 'mean_word_length': 3.2511682242990654, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 23, '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': '5754469', 'n_tokens_mistral': 1202, 'n_tokens_neox': 1108, 'n_words': 263}