Esanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/232742

Change subject: Replace jQuery node with HTMLElement
......................................................................

Replace jQuery node with HTMLElement

Change-Id: I9d084419ac15160c42b6ff65d9311c136b09b4b1
---
M modules/VisualEditor/tests/ext.graph.visualEditor.test.js
M modules/VisualEditor/ve.ce.MWGraphNode.js
2 files changed, 10 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Graph 
refs/changes/42/232742/1

diff --git a/modules/VisualEditor/tests/ext.graph.visualEditor.test.js 
b/modules/VisualEditor/tests/ext.graph.visualEditor.test.js
index 6707082..a6c80c8 100644
--- a/modules/VisualEditor/tests/ext.graph.visualEditor.test.js
+++ b/modules/VisualEditor/tests/ext.graph.visualEditor.test.js
@@ -363,20 +363,20 @@
        } );
 
        QUnit.test( 've.ce.MWGraphNode.static', 2, function ( assert ) {
-               var $testElement = $( '<div>' ),
+               var testElement = document.createElement( 'div' ),
                        renderValidTest = assert.async(),
                        renderInvalidTest = assert.async();
 
-               $( '#qunit-fixture' ).append( $testElement );
+               $( '#qunit-fixture' ).append( testElement );
 
-               ve.ce.MWGraphNode.static.vegaParseSpec( sampleSpecs.areaGraph, 
$testElement ).always(
+               ve.ce.MWGraphNode.static.vegaParseSpec( sampleSpecs.areaGraph, 
testElement ).always(
                        function () {
                                assert.ok( this.state() === 'resolved', 'Simple 
graph gets rendered correctly' );
                                renderValidTest();
                        }
                );
 
-               ve.ce.MWGraphNode.static.vegaParseSpec( 
sampleSpecs.invalidAxesBarGraph, $testElement ).always(
+               ve.ce.MWGraphNode.static.vegaParseSpec( 
sampleSpecs.invalidAxesBarGraph, testElement ).always(
                        function ( failMessageKey ) {
                                assert.ok( failMessageKey === 
'graph-ve-vega-error', 'Invalid graph triggers an error at rendering' );
                                renderInvalidTest();
diff --git a/modules/VisualEditor/ve.ce.MWGraphNode.js 
b/modules/VisualEditor/ve.ce.MWGraphNode.js
index 3b200a2..b8a73d2 100644
--- a/modules/VisualEditor/ve.ce.MWGraphNode.js
+++ b/modules/VisualEditor/ve.ce.MWGraphNode.js
@@ -39,11 +39,11 @@
  * Attempt to render the graph through Vega.
  *
  * @param {Object} spec The graph spec
- * @param {jQuery} $node Element to render the graph in
+ * @param {HTMLElement} element Element to render the graph in
  * @return {jQuery.Promise} Promise that resolves when the graph is rendered.
- * Promise is rejected if there was a problem rendering the graph.
+ * Promise is rejected with an error message key if there was a problem 
rendering the graph.
  */
-ve.ce.MWGraphNode.static.vegaParseSpec = function ( spec, $node ) {
+ve.ce.MWGraphNode.static.vegaParseSpec = function ( spec, element ) {
        var deferred = $.Deferred(),
                node = this,
                canvasNode;
@@ -52,12 +52,12 @@
        if ( spec ) {
                vg.parse.spec( spec, function ( chart ) {
                        try {
-                               chart( { el: $node[0] } ).update();
+                               chart( { el: element } ).update();
 
                                // HACK: If canvas is blank, this means Vega 
didn't render properly.
                                // Once Vega allows for proper rendering 
validation, this should be
                                // swapped for a validation check.
-                               canvasNode = $node[0].children[0].children[0];
+                               canvasNode = element.children[0].children[0];
                                if ( node.isCanvasBlank( canvasNode ) ) {
                                        deferred.reject( 
'graph-ve-vega-error-no-render' );
                                } else {
@@ -102,7 +102,7 @@
        // Clear element
        this.$element.empty();
 
-       this.constructor.static.vegaParseSpec( this.getModel().getSpec(), 
this.$element ).then(
+       this.constructor.static.vegaParseSpec( this.getModel().getSpec(), 
this.$element[0] ).then(
                null,
                function ( failMessageKey ) {
                        node.$element.text( ve.msg( failMessageKey ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/232742
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d084419ac15160c42b6ff65d9311c136b09b4b1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Graph
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to