Code Monkey home page Code Monkey logo

Comments (1)

techfg avatar techfg commented on September 26, 2024

The test is failing due to the following line of code not returning the excepted value for els_count:

var els = $('img,div'),
  els_count = els.find('img[usemap]').length,

When running under zepto, els_count is two (2) rather than the excepted one (1) because Zepto returns all elements found from find rather than a unique element list.

The simple solution would be to adjust as follows:

var els = $('img,div'),
  found_els = els.find('img[usemap]'),
  els_count = $.zepto ? $.zepto.uniq(found_els) : found_els,

However, what this code is attempting to do is wait for configured to be called on every 'found' element that is an imagemap. Currently, we know there is only one actual imagemap under test and all other tests are written with that assumption so having this logic here doesn't add any value. If/When tests are updated to have multiple imagemaps under test on a single page, all test code will need to be adjusted to wait until all maps are 'configured' before continuing.

The intent of this particular test is to ensure that even when non-imagemap elements are passed in to mapster for initialization, only img elements with usemap are actually processed by imagemapster. We can do a more accurate job of actually testing this behavior by having other img and div elements on the test page and then the current assert will actually verify only one img was actually processed as an imagemap.

from imagemapster.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.