Git Product home page Git Product logo

testing-directive's Introduction

Trong quá trình làm việc, Tôi gặp phải không ít các ticket liên quan đến Angularjs và để đảm bảo chất lượng đôi khi tôi phải viết test case cho các function của mình. Bài viết sau đây tôi sẽ chia sẻ những kiến thức mà tôi học được khi viết test cho một directive. Hi vọng nó sẽ hữu ích với bạn.

Nếu các bạn đã viết test cho Angularjs thì các bạn sẽ thấy việc viết test cho Directive có chút khó khăn hơn so với test cho controller hoặc services. Đối với Directive chúng ta cần render ra một tempate. và xác định được chính xác element mà chúng ta sẽ render trên template. Điều này sẽ được thực hiện thông qua đối tượng $complile.

Bài viết này tôi sẽ tập trung nói về việc viết test cho một driective đơn giản và test cho một function thuộc controller nằm trong directive.

Trước tiên tôi sẽ tạo ra một Directive và sử dụng nó xuyên xuốt bài viết để viết test cho nó. ... xem them tai https://viblo.asia/hoang.van.quan/posts/ZK1ov1ryR5b9

testing-directive's People

Contributors

hoangquan avatar

Watchers

James Cloos avatar  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.