import Ember from 'ember';
import {module, test} from 'qunit';
import startApp from '../helpers/start-app';

var App;

module('Acceptance: InlineSvg', {
  beforeEach: function() {
    App = startApp();
  },
  afterEach: function() {
    Ember.run(App, 'destroy');
  }
});

test('displays SVG at root', function(assert) {
  visit('/root');

  andThen(function() {
    assert.ok(find(".kiwi-image-at-root svg").length, "has an SVG");
  });
});

test('displays SVG in subdirectory', function(assert) {
  visit('/subdirectory');

  andThen(function() {
    assert.ok(find(".kiwi-image-in-directory svg").length, "has an SVG which is in a directory");
  });
});

test('adds class to SVG', function(assert) {
  visit('/class');

  andThen(function() {
    assert.ok(find(".kiwi-image-with-a-class svg.with-a-class").length, "has added the class");
  });
});

test('trims unnecessary .svg` extension', function(assert) {
  visit('/extension');

  andThen(function() {
    assert.ok(find(".kiwi-image-with-extension svg").length, "has an SVG, extension was trimmed");
  });
});

test('runs through SVGO', function(assert) {
  visit('/root');

  andThen(function() {
    assert.ok(!find(".kiwi-image-at-root svg title").length, "has stripped the title");
  });
});

@@ -4,36 +4,10 @@
 ort 
-Ember from 'ember';%0Aimport 
 %7B
+ 
 modu
@@ -14,16 +14,17 @@
 le, test
+ 
 %7D from '
@@ -42,54 +42,102 @@
 ort 
-startApp from '../helpers/start-app';%0A%0Avar App
+%7B visit, find %7D from '@ember/test-helpers';%0Aimport %7B setupApplicationTest %7D from 'ember-qunit'
 ;%0A%0Am
@@ -157,37 +157,23 @@
 ance
-: I
+ %7C i
 nline
-S
+-s
 vg',
- %7B%0A  beforeEach:
  fun
@@ -182,105 +182,51 @@
 ion(
+hooks
 ) %7B%0A  
-  App = startApp();%0A  %7D,%0A  afterEach: function() %7B%0A    Ember.run(App, 'destroy'
+setupApplicationTest(hooks
 );%0A
+%0A
   
-%7D%0A%7D);%0A%0A
 test
@@ -249,16 +249,22 @@
 t root',
+ async
  functio
@@ -269,32 +269,40 @@
 ion(assert) %7B%0A  
+  await 
 visit('/root');%0A
@@ -307,34 +307,11 @@
 ;%0A%0A 
- andThen(function() %7B%0A
    
- 
 asse
@@ -343,31 +343,24 @@
 t-root svg%22)
-.length
 , %22has an SV
@@ -366,29 +366,27 @@
 VG%22);%0A  %7D);%0A
-%7D);%0A%0A
+%0A  
 test('displa
@@ -409,16 +409,22 @@
 ectory',
+ async
  functio
@@ -429,32 +429,40 @@
 ion(assert) %7B%0A  
+  await 
 visit('/subdirec
@@ -470,39 +470,16 @@
 ory');%0A%0A
-  andThen(function() %7B%0A
     asse
@@ -516,31 +516,24 @@
 ectory svg%22)
-.length
 , %22has an SV
@@ -563,29 +563,27 @@
 ry%22);%0A  %7D);%0A
-%7D);%0A%0A
+%0A  
 test('adds c
@@ -595,16 +595,22 @@
 to SVG',
+ async
  functio
@@ -615,32 +615,40 @@
 ion(assert) %7B%0A  
+  await 
 visit('/class');
@@ -649,39 +649,16 @@
 ass');%0A%0A
-  andThen(function() %7B%0A
     asse
@@ -712,23 +712,16 @@
 -class%22)
-.length
 , %22has a
@@ -740,29 +740,27 @@
 ss%22);%0A  %7D);%0A
-%7D);%0A%0A
+%0A  
 test('trims 
@@ -788,16 +788,22 @@
 ension',
+ async
  functio
@@ -808,32 +808,40 @@
 ion(assert) %7B%0A  
+  await 
 visit('/extensio
@@ -846,39 +846,16 @@
 ion');%0A%0A
-  andThen(function() %7B%0A
     asse
@@ -898,23 +898,16 @@
 on svg%22)
-.length
 , %22has a
@@ -944,21 +944,19 @@
 ;%0A  %7D);%0A
-%7D);%0A%0A
+%0A  
 test('ru
@@ -972,16 +972,22 @@
 h SVGO',
+ async
  functio
@@ -1000,16 +1000,24 @@
 rt) %7B%0A  
+  await 
 visit('/
@@ -1029,31 +1029,8 @@
 );%0A%0A
-  andThen(function() %7B%0A
     
@@ -1081,15 +1081,8 @@
 le%22)
-.length
 , %22h

update acceptance test