Skip to content
Permalink
Browse files

added some autocomplete tests

  • Loading branch information
SimoneSabba committed Jul 7, 2014
1 parent 7550452 commit a78c3a1496019fea63908edeb32d43b2951ccf57
@@ -0,0 +1,12 @@
<!-- buildexamples:section header --><!-- /buildexamples -->
<script src="../../korboee-conf-test.js" type="text/javascript" charset="utf-8"></script>
<div data-ng-app="Pundit2" class="kee-wrp">
<br>
<korbo-entity-editor conf-name="confTest1"></korbo-entity-editor>
<br>
<korbo-entity-editor conf-name="confTest2"></korbo-entity-editor>
<br>
<korbo-entity-editor conf-name="confTest3"></korbo-entity-editor>
<br>
</div>
<!-- buildexamples:section footer --><!-- /buildexamples -->
@@ -0,0 +1,34 @@
var confTest1 = {
endpoint: "http://korbo2.local:80/v1",
basketID: 1,
globalObjectName : 'KK',
limitSearchResult: 11,
useOnlyCallback: false,
useTafonyCompatibility: true,
labelMinLength: 5

};

var confTest2 = {
endpoint: "http://korbo2.local:80/v1",
limitSearchResult: 3,
globalObjectName : 'FF',
useTafonyCompatibility: true,
onReady: function(){
console.log("widget is ready to use2");
},

autoCompleteMode: 'full',
autoCompleteOptions: 'search'
}

var confTest3 = {
endpoint: "http://korbo2.local:80/v1",
limitSearchResult: 20,
//labelMinLength: 6,
globalObjectName : 'GG',
useTafonyCompatibility: true,

autoCompleteMode: 'simple',
autoCompleteOptions: 'all'
}
@@ -0,0 +1,40 @@
describe("KorboEE autocomplete", function() {


var p = protractor.getInstance();

var fs = require('fs'),
myHttpMock;

fs.readFile('test/e2e/korboeeMock.e2e.js', 'utf8', function(err, data) {
if (err) {
console.log('You need an korboeeMock.e2e.js in test/e2e/');
return console.log(err);
}
/* jshint -W061 */
eval(data);
/* jshint +W061 */
myHttpMock = KorboEEHttpMock;
});

beforeEach(function(){
p.addMockModule('httpBackendMock', myHttpMock);

});

afterEach(function() {
p.removeMockModule('httpBackendMock');
});

it('should compile directive and show the input field', function() {

p.get('/app/examples/korboee-autocomplete-test.html');

// should be visible 3 input fields
p.findElements(protractor.By.css('.kee-input-elem-to-search.kee-input-ok')).then(function(inputType) {
expect(inputType.length).toBe(3);
});

});

});
@@ -0,0 +1,31 @@
// httpBackend mock to handle all http request in e2e test
// include this object in all e2e test that make an http request

var KorboEEHttpMock;
KorboEEHttpMock = function () {
angular.module('httpBackendMock', ['ngMockE2E'])
.run(function ($httpBackend) {
var inputString = "Dante";
var itemResponse = {
data: [{available_languages:["en"],basket_id:1,id:114,label:"Label1",abstract:"Abstract1",type:["http:\/\/person.uri","http:\/\/scientist.uri"],"depiction":""},
{available_languages:["en"],basket_id:1,id:115,label:"Label2",abstract:"Abstract2",type:["http:\/\/person.uri","http:\/\/scientist.uri"],"depiction":""},
{available_languages:["en"],basket_id:1,id:116,label:"Label3",abstract:"Abstract3",type:["http:\/\/person.uri","http:\/\/scientist.uri"],"depiction":""}],
metadata: { limit: 3, offset: 0, totalCount: 3, pageCount: 2 }
};


var resp = {
data: itemResponse,
status: 200
};
var lan = "en";
var offset = 0;

var url = "http://korbo2.local:80/v1/search/items?lang=en&limit=11&offset=0&p=korbo&q=Dante";


$httpBackend.expectGET(url).respond(resp);


});
};

0 comments on commit a78c3a1

Please sign in to comment.
You can’t perform that action at this time.