Giter Club home page Giter Club logo

Comments (9)

squidfunk avatar squidfunk commented on May 5, 2024 1

Released as part of 0.4.2. Please re-open if the problem persists.

from karma-viewport.

squidfunk avatar squidfunk commented on May 5, 2024

Can you provide your karma config?

from karma-viewport.

lsglick avatar lsglick commented on May 5, 2024

Here's most of the config. At one point I'd explicitly set client.useIframe and viewport.context but it didn't seem to make a difference.

config.set({

  basePath: '..',

  plugins: [
    'karma-mocha',
    'karma-webpack',
    'karma-chrome-launcher',
    'karma-phantomjs-launcher',
    'karma-sinon-chai',
    'karma-mocha-reporter',
    'karma-junit-reporter',
    'karma-sourcemap-loader',
    'karma-viewport'
  ],

  // Hack to workaround https://github.com/squidfunk/karma-viewport/issues/29.
  beforeMiddleware: [
      'viewport',
  ],

  frameworks: ['mocha', 'sinon-chai', 'viewport'],

  files: [
    'test/index.js'
  ],

  exclude: [
  ],

  preprocessors: {
    'test/index.js': ['webpack']
  },

  webpack: webpackTestConfig,

  webpackMiddleware: {
    progress: true,
    stats: true,
    debug: true,
    noInfo: false,
    silent: false
  },

  client: {
    mocha: {
      reporter: 'HTML', 
      timeout: 30000
    }
  },

  mochaReporter: {
    showDiff: true
  },

  junitReporter: {
    outputDir: 'reports/karma'
  },

  reporters: ['mocha'],

  colors: true,

  logLevel: config.LOG_INFO,

  autoWatch: false,

  browsers: ['Chrome'],

  // karma-viewport
  viewport: {
    breakpoints: [
      {
        name: 'mobile',
        size: {
          width: 414,
          height: 736
        }
      },
      {
        name: 'tablet',
        size: {
          width: 768,
          height: 1024
        }
      }
    ]
  },

  singleRun: false,

  concurrency: Infinity,
  
  browserNoActivityTimeout: 120000,
  
  });

from karma-viewport.

squidfunk avatar squidfunk commented on May 5, 2024

I'm sorry for not answering for so long. I'm currently on vacation and will look into it in the beginning of September.

from karma-viewport.

spiderpug avatar spiderpug commented on May 5, 2024

I have the same problem. Debugging the commit that broke this functionality yields the following results:

if (config.selector === "#context" && client.useIframe) {

  • config is the global karma config object, not the framework specific config as the code assumes. karma's config setting 'context' is not specified. It should be config.viewport.context.
  • client throws a reference error. It's supposed to be config.client.useIframe.

As stated you can get around that by using:

  config.set({
    // ...
    beforeMiddleware: ['viewport'],
  })

Thanks for providing this plugin. It's super useful for testing CSS media selectors.

from karma-viewport.

squidfunk avatar squidfunk commented on May 5, 2024

Are you both sure that you are using the most recent version (0.4.1)? The code snippet both of you posted relate to a version below 0.4.0. There was indeed a bug in the comment you referenced. The current check negates the client.useIframe property, which is correct and should make your code work:

if (config.context === "#context" && !client.useIframe)

Furthermore note that in 0.4.0 the name of the property config.viewport.selector was changed to config.viewport.context.

from karma-viewport.

spiderpug avatar spiderpug commented on May 5, 2024

I'm sure. This is the current master and it's also what my local package shows. See the framework method, deciding whether to push the middleware or not:

https://github.com/squidfunk/karma-viewport/blob/0.4.1/src/index.js#L62

The commit I referenced shows the point in time when the behaviour broke, not the most recent code. My previous comments and results also relate to the current version (0.4.1) of the plugin, sorry for the confusion.

from karma-viewport.

squidfunk avatar squidfunk commented on May 5, 2024

Ok, sorry, my fault, got the wrong line. This was indeed a copy and paste error. Will provide a fix asap.

from karma-viewport.

squidfunk avatar squidfunk commented on May 5, 2024

A fix is provided in #30 which removes the check. The beforeMiddleware is now always registered which is even better and more extendable.

from karma-viewport.

Related Issues (12)

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.