describe('Onboarding service', function() {
    'use strict';

    var TOUR_OPTIONS_KEY = 'org.talend.dataprep.tour_options';

    var introJsMock = {
        setOptions: function() {return this;},
        oncomplete: function() {return this;},
        onexit: function() {return this;},
        start: function() {}
    };

    beforeEach(module('data-prep.services.onboarding'));

    beforeEach(inject(function($window) {
        $window.introJs = function() {
            return introJsMock;
        };

        spyOn(introJsMock, 'setOptions').and.callThrough();
        spyOn(introJsMock, 'oncomplete').and.callThrough();
        spyOn(introJsMock, 'onexit').and.callThrough();
        spyOn(introJsMock, 'start').and.callThrough();
    }));

    afterEach(inject(function($window) {
        $window.localStorage.removeItem(TOUR_OPTIONS_KEY);
    }));

    it('should return true when tour has not been completed yet', inject(function($window, OnboardingService) {
        //given
        $window.localStorage.removeItem(TOUR_OPTIONS_KEY);

        //when
        var result = OnboardingService.shouldStartTour('dataset');

        //then
        expect(result).toBe(true);
    }));

    it('should return false when tour has already been completed', inject(function($window, OnboardingService) {
        //given
        $window.localStorage.setItem(TOUR_OPTIONS_KEY, JSON.stringify({dataset: true}));

        //when
        var result = OnboardingService.shouldStartTour('dataset');

        //then
        expect(result).toBe(false);
    }));

    it('should configure intro.js options', inject(function(OnboardingService) {
        //given

        //when
        OnboardingService.startTour('dataset');

        //then
        expect(introJsMock.setOptions).toHaveBeenCalled();
        var options = introJsMock.setOptions.calls.argsFor(0)[0];
        expect(options.nextLabel).toBe('NEXT');
        expect(options.prevLabel).toBe('BACK');
        expect(options.skipLabel).toBe('SKIP');
        expect(options.doneLabel).toBe('OK, LET ME TRY!');
    }));

    it('should create/adapt tour step', inject(function(OnboardingService) {
        //when
        OnboardingService.startTour('dataset');

        //then
        expect(introJsMock.setOptions).toHaveBeenCalled();
        var options = introJsMock.setOptions.calls.argsFor(0)[0];
        expect(options.steps[0]).toEqual({
            element: '.no-js',
            position: 'right',
            intro: '<div class="introjs-tooltiptitle">Welcome to Talend Data Preparation</div><div class="introjs-tooltipcontent">To learn more about Talend Data Preparation, take this quick tour</div>'
        });
    }));

    it('should save "dataset" state in localstorage on tour complete', inject(function($window, OnboardingService) {
        //given
        $window.localStorage.removeItem(TOUR_OPTIONS_KEY);

        OnboardingService.startTour('dataset');
        expect(introJsMock.oncomplete).toHaveBeenCalled();

        var oncomplete = introJsMock.oncomplete.calls.argsFor(0)[0];

        //when
        oncomplete();

        //then
        var options = JSON.parse($window.localStorage.getItem(TOUR_OPTIONS_KEY));
        expect(options.dataset).toBe(true);
    }));

    it('should save "dataset" state in localstorage on tour exit', inject(function($window, OnboardingService) {
        //given
        $window.localStorage.removeItem(TOUR_OPTIONS_KEY);

        OnboardingService.startTour('dataset');
        expect(introJsMock.onexit).toHaveBeenCalled();

        var onexit = introJsMock.onexit.calls.argsFor(0)[0];

        //when
        onexit();

        //then
        var options = JSON.parse($window.localStorage.getItem(TOUR_OPTIONS_KEY));
        expect(options.dataset).toBe(true);
    }));

    it('should start onboarding', inject(function($window, OnboardingService) {
        //when
        OnboardingService.startTour('dataset');

        //then
        expect(introJsMock.start).toHaveBeenCalled();
    }));
});
@@ -2036,12 +2036,8 @@
 Be('
-OK, 
 LET 
@@ -2046,9 +2046,8 @@
  TRY
-!
 ');%0A
@@ -2496,16 +2496,24 @@
 ptitle%22%3E
+%3Ccenter%3E
 Welcome 
@@ -2514,17 +2514,21 @@
 lcome to
- 
+%3C/br%3E
 Talend D
@@ -2544,16 +2544,25 @@
 ration%3C/
+center%3E%3C/
 div%3E%3Cdiv
@@ -2600,70 +2600,55 @@
 %3ETo 
-learn more about Talend Data Preparation, take this quick tour
+quickly learn how to use it, click %3Cb%3ENext%3C/b%3E.
 %3C/di

update unit tests