mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-12 16:14:25 +03:00
89b7ff3320
refs #5845 - Updates tag settings screen to match content screen behaviour. Each now tag has it's own route that is link-able from other areas of the app - Updates a number of places where jQuery event handler code was not wrapped in Ember's run loop
54 lines
1.4 KiB
JavaScript
54 lines
1.4 KiB
JavaScript
/* jshint expr:true */
|
|
import { expect } from 'chai';
|
|
import {
|
|
describeComponent,
|
|
it
|
|
} from 'ember-mocha';
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
import Ember from 'ember';
|
|
|
|
const {run} = Ember;
|
|
|
|
describeComponent(
|
|
'gh-cm-editor',
|
|
'Integration: Component: gh-cm-editor',
|
|
{
|
|
integration: true
|
|
},
|
|
function () {
|
|
it('handles editor events', function () {
|
|
this.set('text', '');
|
|
|
|
this.render(hbs`{{gh-cm-editor class="gh-input" value=text}}`);
|
|
let input = this.$('.gh-input');
|
|
|
|
expect(input.hasClass('focused'), 'has focused class on first render')
|
|
.to.be.false;
|
|
|
|
run(() => {
|
|
input.find('textarea').trigger('focus');
|
|
});
|
|
|
|
expect(input.hasClass('focused'), 'has focused class after focus')
|
|
.to.be.true;
|
|
|
|
run(() => {
|
|
input.find('textarea').trigger('blur');
|
|
});
|
|
|
|
expect(input.hasClass('focused'), 'loses focused class on blur')
|
|
.to.be.false;
|
|
|
|
run(() => {
|
|
// access CodeMirror directly as it doesn't pick up changes
|
|
// to the textarea
|
|
let cm = input.find('.CodeMirror').get(0).CodeMirror;
|
|
cm.setValue('Testing');
|
|
});
|
|
|
|
expect(this.get('text'), 'text value after CM editor change')
|
|
.to.equal('Testing');
|
|
});
|
|
}
|
|
);
|