@@ -192,19 +192,7 @@ public function test_render_simple()
192192 $ this ->chat ->setKey ('XYZ123456 ' );
193193 $ ret = $ this ->chat ->render ();
194194
195- $ expected = "<script type= \"text/javascript \">
196- var _smartsupp = _smartsupp || {};
197- _smartsupp.key = 'XYZ123456';
198-
199- window.smartsupp||(function(d) {
200- var s,c,o=smartsupp=function(){ o._.push(arguments)};o._=[];
201- s=d.getElementsByTagName('script')[0];c=d.createElement('script');
202- c.type='text/javascript';c.charset='utf-8';c.async=true;
203- c.src='//www.smartsuppchat.com/loader.js';s.parentNode.insertBefore(c,s);
204- })(document);
205- </script> " ;
206-
207- $ this ->assertEquals ($ expected , $ ret );
195+ $ this ->assertEquals (file_get_contents (dirname (__FILE__ ) . '/chat_code_simple.txt ' ), $ ret );
208196 }
209197
210198 public function test_render_simpleOutput ()
@@ -216,6 +204,16 @@ public function test_render_simpleOutput()
216204 $ this ->expectOutputRegex ('/.*window.smartsupp.*/ ' );
217205 }
218206
207+ public function test_render_async ()
208+ {
209+ $ this ->chat ->setKey ('XYZ123456 ' );
210+ $ this ->chat ->setAsync ();
211+ $ this ->chat ->setAsyncDelay (2500 );
212+ $ ret = $ this ->chat ->render ();
213+
214+ $ this ->assertEquals (file_get_contents (dirname (__FILE__ ) . '/chat_code_async.txt ' ), $ ret );
215+ }
216+
219217 public function test_render_allParams ()
220218 {
221219 $ this ->chat ->setKey ('XYZ123456 ' );
0 commit comments