]> khamidou — GitHub mirrors - electron.git/commitdiff
Use assert.throws
authorKevin Sawicki <kevinsawicki@gmail.com>
Tue, 9 Feb 2016 21:53:10 +0000 (13:53 -0800)
committerKevin Sawicki <kevinsawicki@gmail.com>
Tue, 9 Feb 2016 21:53:10 +0000 (13:53 -0800)
spec/webview-spec.js

index 0b6572a5084be0c69654bf222b0ff7da387f44a7..eb1427e08553f7a699e480967a1415248b86c0f3 100644 (file)
@@ -563,14 +563,9 @@ describe('<webview> tag', function() {
     });
 
     it('throws a custom error when an API method is called before the event is emitted', function() {
-      var readyError = null;
-      try {
-        webview.stop();
-      } catch (error) {
-        readyError = error;
-      }
-
-      assert.equal(readyError.message, 'Cannot call stop because the webContents is unavailable. The WebView must be attached to the DOM and the dom-ready event emmitted before this method can be called.');
+      assert.throws(function () {
+        webview.stop()
+      }, 'Cannot call stop because the webContents is unavailable. The WebView must be attached to the DOM and the dom-ready event emmitted before this method can be called.');
     });
   });