Daniel Werner has uploaded a new change for review.

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


Change subject: Fix for failing tests (MockViewState no instance of ViewState)
......................................................................

Fix for failing tests (MockViewState no instance of ViewState)

MockViewState instances have not been recognized as ViewState instances because
valueview.ViewState.js got loaded twice. After the first time, 
jQuery.valueview.ViewState
is defined and jQuery.valueview.MockViewState inherits from it. At a later 
point the
valueview.ViewState.js gets loaded again and the ViewState constructor from the 
first
time is being overwritten while the prototype chain of MockViewState is still 
holding
a reference to the first ViewState constructor while jQuery.valueview.ViewState 
now is
a reference to the second ViewState constructor.
This also fixes some other related minor issues, e.g. the "constructor" 
property not being
properly set and some missing dependency.

Change-Id: I4cee640185132d659308a3135ca201ae64a23a16
---
M ValueView/ValueView.resources.php
M ValueView/ValueView.tests.qunit.php
M ValueView/resources/jquery.valueview/valueview.ViewState.js
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataValues 
refs/changes/81/85881/1

diff --git a/ValueView/ValueView.resources.php 
b/ValueView/ValueView.resources.php
index 4158194..c02f6d3 100644
--- a/ValueView/ValueView.resources.php
+++ b/ValueView/ValueView.resources.php
@@ -77,7 +77,6 @@
                'jquery.valueview.valueview' => $moduleTemplate + array(
                        'scripts' => array(
                                'jquery.valueview/valueview.valueview.js', // 
the actual widget definition
-                               'jquery.valueview/valueview.ViewState.js',
                        ),
                        'styles' => array(
                                'jquery.valueview/valueview.css',
diff --git a/ValueView/ValueView.tests.qunit.php 
b/ValueView/ValueView.tests.qunit.php
index 66c1d91..e0ccf3c 100644
--- a/ValueView/ValueView.tests.qunit.php
+++ b/ValueView/ValueView.tests.qunit.php
@@ -160,6 +160,7 @@
                        ),
                        'dependencies' => array(
                                'jquery.valueview.experts',
+                               'jquery.valueview.MockViewState',
                                'qunit.parameterize',
                        ),
                ),
diff --git a/ValueView/resources/jquery.valueview/valueview.ViewState.js 
b/ValueView/resources/jquery.valueview/valueview.ViewState.js
index 244844a..23bbc70 100644
--- a/ValueView/resources/jquery.valueview/valueview.ViewState.js
+++ b/ValueView/resources/jquery.valueview/valueview.ViewState.js
@@ -25,7 +25,7 @@
                this._view = valueview;
        };
 
-       SELF.prototype = {
+       $.extend( SELF.prototype, {
                /**
                 * The widget object whose status is represented.
                 * @type jQuery.valueview
@@ -73,6 +73,6 @@
                option: function( key ) {
                        return this._view.option( key );
                }
-       };
+       } );
 
 }( jQuery, jQuery.valueview ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4cee640185132d659308a3135ca201ae64a23a16
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: master
Gerrit-Owner: Daniel Werner <daniel.wer...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to