<commit_before>Ext = window.Ext4 || window.Ext

Ext.require [
  'Rally.alm.FeatureToggle'
]

describe 'Rally.apps.portfoliokanban.PortfolioKanbanApp', ->

  helpers

    _createApp: (settings) ->
      globalContext = Rally.environment.getContext()
      context = Ext.create 'Rally.app.Context',
        initialValues:
          project:globalContext.getProject()
          workspace:globalContext.getWorkspace()
          user:globalContext.getUser()
          subscription:globalContext.getSubscription()

      options =
        context: context,
        renderTo: 'testDiv'

      options.settings = settings if settings?

      @app = Ext.create('Rally.apps.portfoliokanban.PortfolioKanbanApp', options)

      @stub(@app.getContext(), 'isFeatureEnabled').withArgs('ENABLE_SLIM_CARD_DESIGN').returns true

      @waitForComponentReady @app

    _getTextsForElements: (cssQuery) ->
      Ext.Array.map(@app.getEl().query(cssQuery), (el) -> el.innerHTML).join('__')

  beforeEach ->
    @ajax.whenQuerying('typedefinition').respondWith([
      {
        '_ref':'/typedefinition/1'
        ObjectID:'1'
        Ordinal:1
        Name:'Feature'
        TypePath:'PortfolioItem/Feature'
      }
    ])

  afterEach ->
    if @app?
      if @app.down('rallyfilterinfo')?.tooltip?
        @app.down('rallyfilterinfo').tooltip.destroy()

      @app.destroy()

  it 'loads type with ordinal of 1 if no type setting is provided', ->
<commit_msg>DE16897 fixing another infinite loop for portfolio apps<commit_after>Ext = window.Ext4 || window.Ext

Ext.require [
  'Rally.alm.FeatureToggle'
]

describe 'Rally.apps.portfoliokanban.PortfolioKanbanApp', ->

  helpers

    _createApp: (settings) ->
      globalContext = Rally.environment.getContext()
      context = Ext.create 'Rally.app.Context',
        initialValues:
          project:globalContext.getProject()
          workspace:globalContext.getWorkspace()
          user:globalContext.getUser()
          subscription:globalContext.getSubscription()

      options =
        context: context,
        renderTo: 'testDiv'

      options.settings = settings if settings?

      @app = Ext.create('Rally.apps.portfoliokanban.PortfolioKanbanApp', options)

      @stub(@app.getContext(), 'isFeatureEnabled').withArgs('ENABLE_SLIM_CARD_DESIGN').returns true

      @waitForComponentReady @app

    _getTextsForElements: (cssQuery) ->
      Ext.Array.map(@app.getEl().query(cssQuery), (el) -> el.innerHTML).join('__')

  beforeEach ->

    Rally.environment.getContext().context.subscription.Modules = ['Rally Portfolio Manager']

    @ajax.whenQuerying('typedefinition').respondWith([
      {
        '_ref':'/typedefinition/1'
        ObjectID:'1'
        Ordinal:1
        Name:'Feature'
        TypePath:'PortfolioItem/Feature'
      }
    ])

  afterEach ->
    if @app?
      if @app.down('rallyfilterinfo')?.tooltip?
        @app.down('rallyfilterinfo').tooltip.destroy()

      @app.destroy()

  it 'loads type with ordinal of 1 if no type setting is provided', ->

{'fraction_non_alphanumeric': 0.12781456953642384, 'fraction_numerical': 0.004966887417218543, 'mean_word_length': 3.006631299734748, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2757783', 'n_tokens_mistral': 933, 'n_tokens_neox': 900, 'n_words': 149}