<commit_before>library ng_include_spec;

import '../_specs.dart';

main() {
  describe('NgInclude', () {
    TestBed _;

    beforeEach((TestBed tb) => _ = tb);

    it('should fetch template from literal url', async((Scope scope, TemplateCache cache) {
      cache.put('tpl.html', new HttpResponse(200, 'my name is {{name}}'));

      var element = _.compile('<div ng-include="tpl.html"></div>');

      expect(element.innerHtml).toEqual('');

      microLeap();  // load the template from cache.
      scope.context['name'] = 'Vojta';
      scope.apply();
      expect(element.text).toEqual('my name is Vojta');
    }));

    iit('should fetch template from url using interpolation', async((Scope scope, TemplateCache cache) {
      cache.put('tpl1.html', new HttpResponse(200, 'My name is {{name}}'));
      cache.put('tpl2.html', new HttpResponse(200, 'I am {{name}}'));

      var element = _.compile('<div ng-include="{{template}}"></div>');

      expect(element.innerHtml).toEqual('');

      scope.context['name'] = 'Vojta';
      scope.context['template'] = 'tpl1.html';
      microLeap();
      scope.apply();
      microLeap();
      scope.apply();
      expect(element.text).toEqual('My name is Vojta');

      scope.context['template'] = 'tpl2.html';
      microLeap();
      scope.apply();
      microLeap();
      scope.apply();
      expect(element.text).toEqual('I am Vojta');
    }));<commit_msg>test(NgInclude): uniit a test<commit_after>library ng_include_spec;

import '../_specs.dart';

main() {
  describe('NgInclude', () {
    TestBed _;

    beforeEach((TestBed tb) => _ = tb);

    it('should fetch template from literal url', async((Scope scope, TemplateCache cache) {
      cache.put('tpl.html', new HttpResponse(200, 'my name is {{name}}'));

      var element = _.compile('<div ng-include="tpl.html"></div>');

      expect(element.innerHtml).toEqual('');

      microLeap();  // load the template from cache.
      scope.context['name'] = 'Vojta';
      scope.apply();
      expect(element.text).toEqual('my name is Vojta');
    }));

    it('should fetch template from url using interpolation', async((Scope scope, TemplateCache cache) {
      cache.put('tpl1.html', new HttpResponse(200, 'My name is {{name}}'));
      cache.put('tpl2.html', new HttpResponse(200, 'I am {{name}}'));

      var element = _.compile('<div ng-include="{{template}}"></div>');

      expect(element.innerHtml).toEqual('');

      scope.context['name'] = 'Vojta';
      scope.context['template'] = 'tpl1.html';
      microLeap();
      scope.apply();
      microLeap();
      scope.apply();
      expect(element.text).toEqual('My name is Vojta');

      scope.context['template'] = 'tpl2.html';
      microLeap();
      scope.apply();
      microLeap();
      scope.apply();
      expect(element.text).toEqual('I am Vojta');
    }));
{'fraction_non_alphanumeric': 0.18734622144112478, 'fraction_numerical': 0.009138840070298769, 'mean_word_length': 3.210059171597633, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '506447', 'n_tokens_mistral': 894, 'n_tokens_neox': 880, 'n_words': 193}