[ 5 posts ]

Brendan Rice

  • Username: Burt
  • Joined: Fri Jun 01, 2012 6:22 am
  • Posts: 16
  • Offline
  • Profile

Error on testing widget - ... extend is not defined

Post Posted: Tue Jun 12, 2012 5:15 am
+0-
Below is an extract of the test code:

Code:
<script src="/combo/lib/?/yui3/build/yui/yui.js"></script>

<script>

var Y = YUI({
    allowRollup: false,
    filter: 'raw',
    modules: {
        'edit-panel':{
            fullpath: '../js/edit-panel.js',
            requires: ['widget','node','event', 'oop']
        },
        'edit-panel-test': {
            fullpath: 'edit-panel-test.js',
            requires: ['edit-panel', 'yuitest', 'test', 'node-event-simulate', 'oop']
        }
    },
    useBrowserConsole: true
}).use('edit-panel-test', 'edit-panel', 'test', 'yuitest', 'node-event-simulate', 'oop', 'console','widget','node','event', function (Y) {
        console.log(Y);
        new Y.Console().render('#log');
        Y.Test.Runner.run();
    });


I get an error on the following code within my widget that I am trying to test:

Code:
Y.extend(EditPanel, Y.Panel, {


From what I can tell YUI isn't getting initialised correctly in my test and therefore isn't loading the OOP functionality required to extend a class.

Does this sound right and if so can anyone know how to get around it?

Thanks

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile

Re: Error on testing widget - ... extend is not defined

Post Posted: Tue Jun 12, 2012 5:41 am
+1-
Looks to me like you are extending `Y.Panel` but 'panel' is not in your dependency list above, so that would likely error if your extending a class that doesn't exist.

Brendan Rice

  • Username: Burt
  • Joined: Fri Jun 01, 2012 6:22 am
  • Posts: 16
  • Offline
  • Profile

Re: Error on testing widget - ... extend is not defined

Post Posted: Tue Jun 12, 2012 5:52 am
+0-
Thanks for the reply. I changed the code to what is shown below but I still get the error that the Y.extend is not a function. It is almost as if I haven't registered some YUI modules correctly. Any ideas?

Code:
var Y = YUI({
    allowRollup: false,
    filter: 'raw',
    modules: {
        'edit-panel':{
            fullpath: '../js/edit-panel.js',
            requires: ['panel', 'widget','node','event', 'oop']
        },
        'edit-panel-test': {
            fullpath: 'edit-panel-test.js',
            requires: ['panel', 'edit-panel', 'yuitest', 'test', 'node-event-simulate', 'oop']
        }
    },
    useBrowserConsole: true
}).use('panel', 'edit-panel-test', 'edit-panel', 'test', 'yuitest', 'node-event-simulate', 'oop', 'console','widget','node','event', function (Y) {
        console.log(Y);
        new Y.Console().render('#log');
        Y.Test.Runner.run();
    });

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile
Tags:

Re: Error on testing widget - ... extend is not defined

Post Posted: Tue Jun 12, 2012 6:17 am
+1-
You need to provide a file that repro's this, since I can't:

http://jsfiddle.net/davglass/eDY9g/

Brendan Rice

  • Username: Burt
  • Joined: Fri Jun 01, 2012 6:22 am
  • Posts: 16
  • Offline
  • Profile
Tags:

Re: Error on testing widget - ... extend is not defined

Post Posted: Thu Jun 14, 2012 1:08 am
+0-
You were right I had overlooked having a reference to the panel in my code (build.properties - component.requires).

Thanks for the help
  [ 5 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum