<commit_before>import Ember from 'ember';
import { test, moduleForComponent } from 'ember-qunit';
import sinon from 'sinon';
import componentMixin from 'sl-ember-behavior/mixins/component';

let behaviorService;

moduleForComponent( 'sl-unable', 'Unit | Component | sl unable', {
    unit: true,

    beforeEach() {
        behaviorService = Ember.Object.create({
            isUnable: sinon.stub().returns( false )
        });
    }
});

test( 'Successfully mixed component', function( assert ) {
    assert.ok(
        componentMixin.detect( this.subject() )
    );
});

/**
 * Ensures that the template is wrapping the content in a span tag and not in any block-level tags. While it appears
 * that core Ember functionality is being tested this test is ensuring that the implied contract about how this non-UI
 * component is rendered into the DOM is adhered to.
 */
test( 'Renders as a span tag with no classes', function( assert ) {
    this.subject({
        behaviorService: behaviorService
    });

    assert.equal(
        this.$().prop( 'tagName' ),
        'SPAN'
    );
});

test( 'Does not render content when isUnable() returns false', function( assert ) {
    this.subject({
        behaviorService: behaviorService,
        template: Ember.Handlebars.compile(
            'Should not render'
        )
    });

    assert.equal(
        this.$().text(),
        ''
    );
});

test( 'Renders content when isUnable() returns true', function( assert ) {
    this.registry.register(
        'template:test-template',
        Ember.Handlebars.compile( 'Should render' )
    );

    behaviorService.isUnable = sinon.stub().returns( true );

    this.subject({
        behaviorService: behaviorService,
        templateName: 'test-template'
    });

    this.render();

    assert.equal(
        Ember.$.trim( this.$().text() ),
        'Should render'
    );
});

test( 'isUnable() calls isUnable() on the behavior service', function( assert ) {
    this.subject({
        behaviorService: behaviorService,
        activity: 'anActivity',
        resource: 'aResource',
        possible: true
    });

    this.render();

    assert.ok(
        behaviorService.isUnable.withArgs( 'anActivity', 'aResource', true ).calledOnce,
        'isUnable() was called with the correct params'
    );<commit_msg>removed two unit tests that are now covered by integration tests<commit_after>import Ember from 'ember';
import { test, moduleForComponent } from 'ember-qunit';
import sinon from 'sinon';
import componentMixin from 'sl-ember-behavior/mixins/component';

let behaviorService;

moduleForComponent( 'sl-unable', 'Unit | Component | sl unable', {
    unit: true,

    beforeEach() {
        behaviorService = Ember.Object.create({
            isUnable: sinon.stub().returns( false )
        });
    }
});

test( 'Successfully mixed component', function( assert ) {
    assert.ok(
        componentMixin.detect( this.subject() )
    );
});

/**
 * Ensures that the template is wrapping the content in a span tag and not in any block-level tags. While it appears
 * that core Ember functionality is being tested this test is ensuring that the implied contract about how this non-UI
 * component is rendered into the DOM is adhered to.
 */
test( 'Renders as a span tag with no classes', function( assert ) {
    this.subject({
        behaviorService: behaviorService
    });

    assert.equal(
        this.$().prop( 'tagName' ),
        'SPAN'
    );
});

test( 'isUnable() calls isUnable() on the behavior service', function( assert ) {
    this.subject({
        behaviorService: behaviorService,
        activity: 'anActivity',
        resource: 'aResource',
        possible: true
    });

    this.render();

    assert.ok(
        behaviorService.isUnable.withArgs( 'anActivity', 'aResource', true ).calledOnce,
        'isUnable() was called with the correct params'
    );
{'fraction_non_alphanumeric': 0.1196295343452534, 'fraction_numerical': 0.0, 'mean_word_length': 2.8495049504950494, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3211119', 'n_tokens_mistral': 1079, 'n_tokens_neox': 1060, 'n_words': 343}