GithubHelp home page GithubHelp logo

mmaday / gpt-mock Goto Github PK

View Code? Open in Web Editor NEW

This project forked from krux/gpt-mock

0.0 1.0 0.0 1.15 MB

Node.js mock library for Google Publisher Tags (gpt)

License: Apache License 2.0

JavaScript 100.00%

gpt-mock's Introduction

Overview

Version License Build Status Code Climate Coverage Dependencies Commitizen friendly semantic-release

A test library to mock out the Google Publisher Tag library.

Installation

You can include gpt-mock using npm:

npm install --save-dev gpt-mock

Accessing

ES6/ES2015

import GPT from 'gpt-mock';

AMD

define(['gpt-mock'], function(GPT) {

});

CommonJS

var GPT = require('gpt-mock');

Usage

This library is used to mock out the Google Publisher Tag (GPT) library, so the most natural way to use this would be:

window.googletag = new GPT();

Note that the instance is left as "unloaded", meaning apiReady will be false, and googletag.cmd.push will only accumulate the functions.

To mark the tag library as having been loaded, use the following:

window.googletag._loaded();

This library is intended to be as API-compatible as possible with the production code. Any member that starts with an underscore (_) is not part of the API and is a mock implementation detail.

Help/Bugs/Requests

We ♥ bug reports.

Have a problem? Need help? Would you like additional functionality added? We use GitHub's ticket system for keeping track of these requests.

Please check out the existing issues, and if you don't see that your problem is already being worked on, please file a new issue. The more information the better to describe your problem.

Contributing

We ♥ forks and pull requests.

Please see CONTRIBUTING.md for full details.

Environment

The project requires nodejs (>=5.6) and npm (>=3.6.0) for development. It has no runtime dependencies.

Developing

Check the code out and install the development dependencies using:

npm install

Building

To build the code, run

npm run build

Linting

We use ESLint and JSCS to do static analysis of the JavaScript and keep things smelling good. To run both, use:

npm run lint

Testing

Using travis-ci, the Mocha unit tests are run on every commit using PhantomJS to run the tests with a real browser.

To test the code locally, you can use:

npm test

To run tests in Test-Driven-Development mode, where the test will be run after every change, use:

npm run tdd

Issue Guidelines

Please add a failing bug test and create a Pull Request.

License

See LICENSE.

Some of the documentation incorporated into this source code is based on the Google documentation which is licensed under the Creative Commons Attribution 3.0 License. Some of the material may have been modified for use in this library. Copyright of the incorporated documentation remains Google, Inc. Google is a registered trademark of Google and/or its affiliates and this project is not intended to represent that Google endorses this library.

gpt-mock's People

Contributors

mmaday avatar

Watchers

 avatar

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.