Beispiel #1
0
        it("allows linkto to work", function() {
            helper.registerLink('MySymbol', 'asdf.html');

            expect(helper.linkto('MySymbol')).toBe('<a href="asdf.html">MySymbol</a>');

            delete helper.longnameToUrl.MySymbol;
        });
Beispiel #2
0
    members.externals.forEach(function(item) {
        var url = helper.linkto( item.longname, item.name.replace(/(^"|"$)/g, '') );
        var entryPath = regExp.exec(url)[1];

        entries.push( {
            name: item.name,
            type: convertToDashType(item.kind),
            path: entryPath
        });
    });
Beispiel #3
0
    members.globals.forEach(function (item) {
        var url = helper.linkto(item.longname, item.name);
        var entryPath = regExp.exec(url)[1];
        entries.push( {
            name: item.longname,
            type: convertToDashType(item.kind),
            path: entryPath
        });

    });
Beispiel #4
0
        members[key].forEach(function (item) {
            var url = helper.linkto(item.longname, item.name);
            var entryPath = regExp.exec(url)[1];
            entries.push( {
                name: item.longname.replace('module:', ''),
                type: convertToDashType(item.kind),
                path: entryPath
            });

        });
Beispiel #5
0
function link(item, linkText, linkClass, fragmentId) {
    let htmlLink;
    let regExp;

    if (linkText) {
        linkText = templateHelper.htmlsafe(linkText);
        regExp = new RegExp(util.format('(>(%s)<\\/)', escape(linkText)));
    }

    htmlLink = templateHelper.linkto(item, linkText, linkClass, fragmentId);
    if (regExp) {
        htmlLink = htmlLink.replace(regExp, (match, p1, p2) => p1.replace(p2, softBreak(p2)));
    }

    return htmlLink;
}
Beispiel #6
0
 it('includes a "class" attribute in the link if a class is specified', function() {
     var link = helper.linkto('linktoTest', 'link text', 'myclass');
     expect(link).toEqual('<a href="test.html" class="myclass">link text</a>');
 });
Beispiel #7
0
 it('uses the link text if it is specified', function() {
     var link = helper.linkto('linktoTest', 'link text');
     expect(link).toEqual('<a href="test.html">link text</a>');
 });
Beispiel #8
0
 it('uses the longname as the link text if no link text is provided', function() {
     var link = helper.linkto('linktoTest');
     expect(link).toEqual('<a href="test.html">linktoTest</a>');
 });
Beispiel #9
0
     'link text are specified', function() {
     var link = helper.linkto('example', 'link text');
     expect(link).toEqual('link text');
 });
Beispiel #10
0
 it('returns the link text if only the link text is specified', function() {
     var link = helper.linkto(null, 'link text');
     expect(link).toEqual('link text');
 });
Beispiel #11
0
 it('returns the longname if only the longname is specified and has no URL', function() {
     var link = helper.linkto('example');
     expect(link).toEqual('example');
 });
Beispiel #12
0
 function TocItem(item, children) {
     this.label = helper.linkto(item.longname, name.stripNamespace(item.name));
     this.id = item.longname;
     this.children = children || [];
 }
 item.type.names.forEach(function(name) {
   types.push( helper.linkto(name, helper.htmlsafe(name)) );
 });
Beispiel #14
0
 it("is careful with longnames that are reserved words in JS", function() {
     // we don't have a registered link for 'constructor' so it should return the text 'link text'.
     var link = helper.linkto('constructor', 'link text');
     expect(typeof link).toBe('string');
     expect(link).toBe('link text');
 });
Beispiel #15
0
 it("adding an entry to it allows me to link with linkto", function() {
     helper.longnameToUrl.foo2 = 'bar.html';
     expect(helper.linkto('foo2')).toBe('<a href="bar.html">foo2</a>');
     delete helper.longnameToUrl.foo2;
 });