2016-07-16 01:58:35 +03:00
/* jshint expr:true */
import { expect } from 'chai' ;
2016-11-24 01:50:57 +03:00
import { describe , it } from 'mocha' ;
import { setupComponentTest } from 'ember-mocha' ;
2016-07-16 01:58:35 +03:00
2016-11-24 01:50:57 +03:00
describe ( 'GhUpgradeNotificationComponent' , function ( ) {
setupComponentTest ( 'gh-upgrade-notification' , {
2016-07-16 01:58:35 +03:00
needs : [ 'helper:gh-format-html' ]
2016-11-24 01:50:57 +03:00
} ) ;
2016-07-16 01:58:35 +03:00
2016-11-24 01:50:57 +03:00
beforeEach ( function ( ) {
let upgradeMessage = { 'content' : 'Ghost 10.02.91 is available! Hot Damn. <a href="http://support.ghost.org/how-to-upgrade/" target="_blank">Click here</a> to upgrade.' } ;
this . subject ( ) . set ( 'upgradeNotification' , upgradeMessage ) ;
} ) ;
2016-07-16 01:58:35 +03:00
2016-11-24 01:50:57 +03:00
it ( 'renders' , function ( ) {
// creates the component instance
let component = this . subject ( ) ;
expect ( component . _state ) . to . equal ( 'preRender' ) ;
2016-07-16 01:58:35 +03:00
2016-11-24 01:50:57 +03:00
// renders the component on the page
this . render ( ) ;
expect ( component . _state ) . to . equal ( 'inDOM' ) ;
expect ( this . $ ( ) . prop ( 'tagName' ) ) . to . equal ( 'SECTION' ) ;
expect ( this . $ ( ) . hasClass ( 'gh-upgrade-notification' ) ) . to . be . true ;
// caja tools sanitize target='_blank' attribute
expect ( this . $ ( ) . html ( ) ) . to . contain ( 'Hot Damn. <a href="http://support.ghost.org/how-to-upgrade/">Click here</a>' ) ;
} ) ;
} ) ;