Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8683927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:10:02+00:00 2026-06-12T22:10:02+00:00

I have set up a maven project to use the jasmin-maven-plugin for testing my

  • 0

I have set up a maven project to use the jasmin-maven-plugin for testing my javascript code. The plugin is set up like this:

        <plugin>
            <groupId>com.github.searls</groupId>
            <artifactId>jasmine-maven-plugin</artifactId>
            <version>1.2.0.0</version>
            <extensions>true</extensions>
            <executions>
                <execution>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <jsSrcDir>src/main/webapp/js</jsSrcDir>
                <jsTestSrcDir>src/test/javascript</jsTestSrcDir>
                <sourceIncludes>
                        <include>jquery-1.8.2.min.js</include>
                        <include>jquery-ui-1.8.13.custom.min.js</include>
                        <include>jquery.json-2.2.js</include>
                        <include>stylesheet.js</include>
                        <include>**/*.js</include>
                </sourceIncludes>
            </configuration>
        </plugin>

I have written a javascript method that makes use of jQuery for event handling. The code is like this:

    registerDragSurface: function ( element, onDrag ) {

        // Wrap every drag surface registration in a closure
        // to preserve the given set of arguments as local variables
        (function($, element, dragdropsystem, onDrag) {

            // Register a mousemove event on the drag surface
            $(element).mousemove (function ( event ) {

                // If the user is dragging
                if (dragdropsystem.isDragging) {

                    // Call the onDrag method with 
                    // the given element and event
                    onDrag (element, event);
                }
            });

            // Register a mouseup event on the drag surface
            $(element).mouseup (function ( event ) {

                // If the user is dragging
                if (dragdropsystem.isDragging) {

                    // Call the onDragEnded function
                    dragdropsystem.onDragEnded();
                }

                // We are not dragging anymore, and
                // the left mousebutton has been released
                dragdropsystem.isDragging = false;
                dragdropsystem.isMouseDown = false;
            });

        })($, element, this, onDrag);
    },

I have then written a jasmine spec to test the function. The code is here:

describe("linkedforms.dragdrop", function() {

    var dragdrop = linkedforms.dragdrop;

    it("test that a drag surface can be registered and onDragCallback is called", function () {

        var dragSurface = {};
        var onDragCallback = jasmine.createSpy("onDragCallback");

        dragdrop.registerDragSurface(dragSurface, onDragCallback);
        dragdrop.isDragging = true;

        jQuery(dragSurface).trigger("mousemove");
        expect(onDragCallback).toHaveBeenCalled();
        expect(dragdrop.isDragging).toBe(true);

        jQuery(dragSurface).trigger("mouseup");
        expect(dragdrop.isDragging).toBe(false);
    });
});

I can run mvn jasmine:bdd from the command line, and then visit

    http://localhost:8234 

to run the tests. This works fine, and all my specs pass. I then try to run the tests from maven using mvn test, but then it breaks. It says :

* Expected spy onDragCallback to have been called.
* Passed.
* Expected true to be false.

This makes me suspect that the jQuery event system does not work properly when run from mvn test and thus in the HtmlUnit browser. Does anybody know how to fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:10:02+00:00Added an answer on June 12, 2026 at 10:10 pm

    I figured out that it works if I change the jQuery implementation from jquery-1.8.2.min.js [production] to jquery-1.8.2.js [development].

    Anyone have any ideas why this is so?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have set up my maven project using the m2e plugin in eclipse indigo,
I have a maven project that has a set of library dependancies that are
I'm running Eclipse Indigo on Mac 10.7.4. I have a Maven (3.0.3) project set
Consider this scenario. I have a small enterprise project dev environment. We use archiva
I'm got a pretty simple question... I have a Maven 3 project set up
I am trying to use the aspectj-maven-plugin in a maven project. At compile time,
I have a Clojure project that I would like to package and use in
I have a multi module Spring project that I set up using Maven: my-root
I have written a Maven plugin abstractor, called maven-base-plugin. This plugin goes over all
I have a big Maven multi-module build set up in my Jenkins. It is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.